Search Posts

Category: cors

400 Bad Request during magento 2 REST API Call

When using $http.get in angular, I have a problem: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource….. $http({ method: ‘GET’, url: ‘https://<magento_host>/rest/default/V1/orders?searchCriteria[filter_groups][0][filters][0][field]=status&searchCriteria[filter_groups][0][filters][0][value]=processing,pending&searchCriteria[filter_groups][0][filters][0][condition_type]=in’, headers : { ‘Authorization’: ‘Bearer xxxxxxxxxxxxxxx’ } }).success(function (data) { }).error(function (data) { }); To avoid cross origin issue, I set below method in .htaccess file in Apache server. Header always set Access-Control-Allow-Origin “*” Header always set Access-Control-Allow-Methods “POST, GET, OPTIONS, PUT, DELETE” Header always set Access-Control-Allow-Headers: Authorization In […]

Cors configuration not working spring boot + angular [duplicate]

This question already has an answer here: Response header is present in browser but not parsed by Angular $http response.headers() 2 answers i’m trying to get authentication token from header “autherntication” using angular, but when i use “console.log(response.headers()); i got only 1) cache-control 2) expires 3) pragma in dev tools there are all headers, i tried a log of filters but nothing working 🙁 , thanks for any help ! Fragment of Web configuration @Override […]

Angularjs Pingdom API CORS

I’ve a angularjs aplication that need access Pingdom API, when I do request using Postman all work fine, but when I use AngularJs $http service doesn’t work. My http request: $http.get(url).then( function (response) { deferred.resolve(response); }, function (err) { deferred.reject(err); } ); output: XMLHttpRequest cannot load https://api.pingdom.com/api/2.0/checks/xxxxxxx. Response for preflight has invalid HTTP status code 401 Common request config: $httpProvider.defaults.headers.post = {}; $httpProvider.defaults.headers.put = {}; $httpProvider.defaults.headers.patch = {}; $httpProvider.defaults.headers.delete = {}; $httpProvider.defaults.headers.common[‘content-type’] = “application/json”; $httpProvider.defaults.headers.common[‘authorization’] […]

SLIM php Angularjs CORS

I’m using SLIM framework as backend and Angularjs as frontend.Normal GET and POST API’s is working fine.Whenever i pass the headers in GET or POST method it is throwing 404 error.I used the .htaccess file for CORS. RewriteEngine On # Some hosts may require you to use the `RewriteBase` directive. # If you need to use the `RewriteBase` directive, it should be the # absolute physical path to the directory that contains this htaccess file. […]