cors

Angular and PHP project 'Access-Control-Allow-Origin' header contains multiple values

最后都变了- 提交于 2019-12-25 00:13:28
问题 I am working on a php and angular 6 based single page application. The project runs normally except for today when I saw the following error at the console: Access to XMLHttpRequest at 'http://dev.local/scripts/login.php' from origin 'http://localhost:4200' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values 'http://localhost:4200, *', but only one is allowed. By dev.local I mean, the virtual host created using wampserver for testing purposes. On

JQuery ajax OPTIONS authorisation request not working

為{幸葍}努か 提交于 2019-12-24 20:22:53
问题 I'd like to POST data to another domain and receive the confirmation message returned by the action. So to get CORS to work I've got an options action to handle the OPTION HTTP method (on the same path as the POST) in my rails controller, which currently looks like this: def options headers['Access-Control-Allow-Origin'] = "*" headers['Access-Control-Allow-Methods'] = 'GET, POST, PUT, OPTIONS' headers['Access-Control-Max-Age'] = '100' headers['Access-Control-Allow-Headers'] = '*, x-requested

Cross-Origin Request Blocked: Azure App Service Issue

时间秒杀一切 提交于 2019-12-24 20:22:48
问题 Any Ajax / JQuery call to APP Service(http://xxxx.azurewebsites.net) throw bellow error Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://api-xxx.azurewebsites.net/api/demo/1234567. (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘(null)’). Point to be Noted: 1. CORS set to * in Azure Portal 2. REST API also CORS Enabled. config.EnableCors(); CORS setting in controller level [EnableCors(origins: "*", headers: "*", methods: "

Problems with GET call to rest API

試著忘記壹切 提交于 2019-12-24 19:55:24
问题 I am using, for the first time, angularJs and I would do a thing very simple, but I don't know what I wrong. I have my code in my local env and the API is on web (I used free tool to create a simple API). I created this simple API: http://www.mocky.io/v2/5a1fedce310000221bc0b08b that return: {"id" : 1, "name" : "France - Mainland", "desc": "some description" }, {"id" : 2, "name" : "Gibraltar", "desc": "some description"}, {"id" : 3, "name" : "Malta", "desc": "some description"} Now I have my

How to enable CORS from .htaccess (inside ZURB Foundation Project)

柔情痞子 提交于 2019-12-24 18:56:30
问题 So this is the first time I build a website in Full and my own, including front-end, back-end and database. I'm using the ZURB Foundation Framework (ZURB Template) which makes the project modular using Webpack4, Babel7 and Gulp (Taskrunner). Ive downloaded the latest portable XAMPP distribution for windows and run apache from it. So far, I definitely CAN get my backend to interact with my front-end. My apache is running on localhost:8099, I've set the Root to serve the respective directory

google storage vedio files cannot plays directly from localhost angular

孤人 提交于 2019-12-24 18:25:12
问题 has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access. this message when trying to load wave file from google storage. i tried these steps but it doesn't work, Use the gsutil cors command to configure CORS on a bucket: https://cloud.google.com/storage/docs/configuring-cors 回答1: If you are using Chrome, I want to mention that Chrome does not support localhost for CORS

when jquery comes from CDN, are ajax calls cross-origin?

时光怂恿深爱的人放手 提交于 2019-12-24 16:53:02
问题 I've recently started delegating to a CDN-hosted jquery, forgetting about my ajax calls being impacted by CORS -- oops. Surprisingly, we haven't seen browsers making much fuss about it! Specifically, as far as we can tell only one particular browser does a preflight OPTIONS (the agent is "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0"). Vast majority of browsers out there, including Chrome, FF or Safari are perfectly happy without the preflight -- one of the reasons why we didn't

when jquery comes from CDN, are ajax calls cross-origin?

偶尔善良 提交于 2019-12-24 16:51:53
问题 I've recently started delegating to a CDN-hosted jquery, forgetting about my ajax calls being impacted by CORS -- oops. Surprisingly, we haven't seen browsers making much fuss about it! Specifically, as far as we can tell only one particular browser does a preflight OPTIONS (the agent is "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0"). Vast majority of browsers out there, including Chrome, FF or Safari are perfectly happy without the preflight -- one of the reasons why we didn't

Express CORS domain whitelist

£可爱£侵袭症+ 提交于 2019-12-24 16:35:16
问题 I am using this module to handle cors requests https://www.npmjs.com/package/cors I need to restrict all domains except whitelisted From official CORS module example: var whitelist = ['http://example1.com', 'http://example2.com']; var corsOptions = { origin: function(origin, callback){ var originIsWhitelisted = whitelist.indexOf(origin) !== -1; callback(null, originIsWhitelisted); } }; app.get('/products/:id', cors(corsOptions), function(req, res, next){ res.json({msg: 'This is CORS-enabled

Using CORS Still Give Cross Origin Error

邮差的信 提交于 2019-12-24 16:27:11
问题 I'm trying to access a node route through angular $http using the cors module. I've tried a simple app.use(cors()); but still get the error. And I've tried adding from the cors documentation a whitelist of URLs var corsOptions = { origin: function(origin, callback){ var originIsWhitelisted = whitelist.indexOf(origin) !== -1; callback(null, originIsWhitelisted); } }; app.get('/someroute/:someparam/', cors(corsOptions), function(req, res, next){ mymodule.getData(req.params.someparam, function