Search Posts

Category: cors

Centralized session in multiple product having different domain

I am developing centralized admin module for multiple product. Trying to maintain same session across multiple product. For Product1 : Authenticate successfully and send token in response header Request URL:http://localhost:8080/admin-web/rest/authenticate/ Request Headers Accept:application/json, text/plain, */* Accept-Encoding:gzip, deflate Accept-Language:en-US,en;q=0.8 Cache-Control:no-cache Connection:keep-alive Host:localhost:8080 Origin: Pragma:no-cache Referer: User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.109 Safari/537.36 Response Headers Set-Cookie:token=asdf123sfs1f23sfsf321sfsf21; Version=1; Comment=””; Domain=localhost; Path=/ Access-Control-Allow-Credentials:true Access-Control-Allow-Origin: Content-Encoding:gzip Content-Type:application/json Date:Mon, 13 Nov 2017 12:38:27 GMT Server:Apache-Coyote/1.1 Transfer-Encoding:chunked Vary:Origin Vary:Accept-Encoding […]

CORS issue between web/android/ios

when trying to $.ajax to fetch some content from other websites in my website, I got the error. Failed to load No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:8100‘ is therefore not allowed access. I knew if the target website didn’t allow localhost:8100 to fetch the data, I cannot fetch it in the client side on the web. However, I found that mobile app (not mobile browser, but android/ios application) does […]

NodeJS. Error: unable to verify the first certificate

I’m programming a web application with AngularJS and I use NodeJS because of CORS problems. Well, when I’m trying to make the request in my node I get this error: events.js:160 throw er; // Unhandled ‘error’ event ^ Error: unable to verify the first certificate at Error (native) at TLSSocket.<anonymous> (_tls_wrap.js:1092:38) at emitNone (events.js:86:13) at TLSSocket.emit (events.js:185:7) at TLSSocket._finishInit (_tls_wrap.js:610:8) at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:440:38) My NodeJS file (index.js): var express = require(‘express’) var cors = require(‘cors’) […]

Response for preflight has invalid HTTP status code 400 (CORS enabled in browser)

I am working on Angular 1 / tech stack based web application. For some reason, I can not deploy api server on my local env, using Production server. And I launched UI side with nginx in local env. Login page is: http://localhost:8080/login.html And when click login button, it calls API from production server. But I am getting error: Response for preflight has invalid HTTP status code 400 I opened Cross domain option in […]

Spring boot CORS Filter not working with AngularJS

I have created a SpringBoot application which has an AngularJS front-end and I am not using any Spring Security modules. I have added the @CrossOrigin annotation in my controller as follows @CrossOrigin(origins = “http://localhost:3000”, maxAge = 3600) @RestController public class MyController { public static final Logger logger = LoggerFactory.getLogger(MyController.class); ….. ….. I have also created a CORS filter as shown below. @Component public class CORSFilter implements Filter { public void doFilter(ServletRequest req, ServletResponse res, FilterChain […]

CORS configuration on IIS 6 webserver

From an angular 4 application I’m trying to access an older .aps webpage on an IIS server. I am getting a 401 error which I believe is CORS related. Based on information I found I have configured the IIS server with the following header information: Access-Control-Allow-Origin: * Access-Control-Allow-Methods: GET,PUT,POST,DELETE,OPTIONS Access-Control-Allow-Headers: Content-Type I have done both at the application level and at the webserver level. But I still get the 401 error. The information I am […]

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 Response for preflight has invalid HTTP status code 401 Common request config: $ = {}; $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. […]