Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Angular Laravel has been blocked by CORS policy: Request header field x-requested-with is not allowed by Access-Control-Allow-Headers in preflight response.

namespace AppHttpMiddleware;
use Closure;
class Cors
{
    public function handle($request, Closure $next)
    {
        $response = $next($request);
        $response->header('Access-Control-Allow-Methods', 'HEAD, GET, POST, PUT, DELETE');
        $response->header('Access-Control-Allow-Headers', $request->header('Access-Control-Request-Headers'));
        $response->header('Access-Control-Allow-Origin', '*');
        return $response;
    }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: JS automate a click 
Javascript :: javascript array 
Javascript :: javascript get parent by tag 
Javascript :: javascript two character integer 
Javascript :: javascript get element by rel attribute 
Javascript :: lorem ipsum json api 
Javascript :: collapse uncollapse jquery 
Javascript :: download jquery 
Javascript :: how to make link in discord.js 
Javascript :: js array of objects get a specific key from all objects 
Javascript :: react text input onchange 
Javascript :: what indexof in javascript 
Javascript :: set background color dynamically javascript 
Javascript :: how to autoload config files added in composer.json laravel 
Javascript :: let in javascript 
Javascript :: create a solid.js project 
Javascript :: javascript new date dd/mm/yyyy 
Javascript :: pyramid javascript 
Javascript :: react router dom v6 active link 
Javascript :: how to change materil ui divider coloer 
Javascript :: show hidden element javascript 
Javascript :: check many keys in objects 
Javascript :: typescript class constructor overload 
Javascript :: confirm javascript 
Javascript :: copy to clipboard 
Javascript :: remove item at index in array javascript 
Javascript :: jest expect not contain 
Javascript :: how to get last string in javascript 
Javascript :: @tippyjs/react 
Javascript :: javascript get referrer 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =