cors

AngularJS: Refused to set unsafe header “Access-Control-Request-Headers”

落花浮王杯 提交于 2021-02-07 11:32:10
问题 I'm trying to call a REST API running locally using AngularJS. Here is the AngularJS code : $http.defaults.headers.common = {"Access-Control-Request-Headers": "accept, origin, authorization"}; $http.defaults.headers.common['Authorization'] = 'Basic amF5M2RlYzpqYXk='; $http({method: 'GET', url: 'http://127.0.0.1:5000/user/jay3dec'}). success(function(data, status, headers, config) { }). error(function(data, status, headers, config) { alert(data); }); But I'm getting an errors in the browser

Cross origin request and mixed-content only on Firefox

旧街凉风 提交于 2021-02-07 10:10:24
问题 I'm working on a project which requires HTTPS, so I startup a HTTPS server with self-signed certificate. I also have an HTTP API Server with CORS enabled. I'm able to fetch API request on Chrome. Here the header of preflight response(with HTTP status code 204): Access-Control-Allow-Credentials: true Access-Control-Allow-Headers: appversion,channel,content-type,language Access-Control-Allow-Methods: GET,HEAD,PUT,PATCH,POST,DELETE Access-Control-Allow-Origin: https://localhost:3001 Connection:

Using CORS and CSRF together in Ionic app

核能气质少年 提交于 2021-02-07 05:23:26
问题 I'm developing a android app using Ionic Framework based in a AngularJS web site I developed using Jhipster. As I already have server code running in my web application, I've choose Ionic to work as UI and call server when needed, but I'm having some issues in my development enviroment. As I run my application using Ionic serve, I need use CORS to make requests to server. My web application was developed using CSRF token with Spring Security I'm using Apache CORS filter configured this way:

header('Access-Control-Allow-Origin: *'); Not allowing CORS request

那年仲夏 提交于 2021-02-06 09:12:09
问题 I have a PHP file which generates a JSON document. I've set the header as follows but am still getting an error. header('Access-Control-Allow-Origin: *'); header('Content-Type: application/json'); Error message: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://mysubdomain.mydomain.com' is therefore not allowed access. I've tried explictly allowing mysubdomain.mydomain.com using header('Access-Control-Allow-Origin: https://mysubdomain.mydomain.com')

header('Access-Control-Allow-Origin: *'); Not allowing CORS request

六眼飞鱼酱① 提交于 2021-02-06 09:10:15
问题 I have a PHP file which generates a JSON document. I've set the header as follows but am still getting an error. header('Access-Control-Allow-Origin: *'); header('Content-Type: application/json'); Error message: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://mysubdomain.mydomain.com' is therefore not allowed access. I've tried explictly allowing mysubdomain.mydomain.com using header('Access-Control-Allow-Origin: https://mysubdomain.mydomain.com')

Spring boot app return Access to XMLHttpRequest at “myURL” has been blocked by CORS policy

柔情痞子 提交于 2021-02-05 09:32:08
问题 i'm stuck with this issue: i use a spring boot app in backend and angular app for the front, the issue is when i call a specific rest url in the backend that uses a jar dependency that i have added to the backend as maven system scope dependency i get a cors error. All other backend urls are working fine here is how i included the jar dependency for the backend: <dependency> <groupId>com.ex</groupId> <artifactId>lib</artifactId> <version>1.0</version> <scope>system</scope> <systemPath>$

Uploading formData file from client to S3 using createPresignedPost or getPresignedUrl fails due to CORS

跟風遠走 提交于 2021-02-05 09:24:26
问题 I'm using a React web app and trying to upload a file to AWS S3. I've tried everything both locally ( localhost:3000 ) and when deployed to production (Vercel serverless functions). I first use a fetch to retrieve a presigned url for the file upload, which works perfectly: module.exports = async (req, res) => { let {fileName, fileType} = req.body; const post = await s3.createPresignedPost({ Bucket: BUCKET_NAME, Fields: { key: fileName }, ContentType: fileType, Expires: 60 }); res.status(200)

Why aren't POST requests always preflighted?

余生长醉 提交于 2021-02-05 06:47:45
问题 According to MDN, POST requests are not preflighted if the Content-Type is any of application/x-www-form-urlencoded , multipart/form-data , or text/plain . But isn't multipart/form-data exactly as unsafe as application/xml ? For instance I would expect cross-origin POST requests to the url http://bank.com/money-orders/ to always be disallowed, regardless of the content type the endpoint accepts. 回答1: Because: Before CORS was ever even conceived of, it was possible to send a cross-origin POST

On Firefox, CORS request gives error “:” (colon)

别来无恙 提交于 2021-02-04 17:35:47
问题 On Chrome, I'm having no troubles making a cross domain request, however on Firefox (Ubuntu 14.04), I get an error that consists only of a colon on the line that calls for the xmlhttprequest. xmlhttp.open("GET", "http://x.x.x.x:xxxx/folder/file.xml", false); The error message is just ":". 回答1: Try Disabling AdBlock I was having a similar issue where all of my XMLHttpRequests were going through except for a few very specific ones where even minor URL changes fixed the problem. And the only

Cors Filter - Allow all sub domains

落花浮王杯 提交于 2021-02-04 13:24:09
问题 I would like my CorsFilter to do the following: // populating the header required for CORS response.addHeader( "Access-Control-Allow-Origin", "https://*.myDomain.com"); The whole idea is to allow the following domains to make a request: sub1.myDomain.com, sub2.myDomain.com, sub3.myDomain.com .... sub100.myDomain.com This didn't work for me. How can I achieve this? Iv'e tried: response.addHeader( "Access-Control-Allow-Origin", "*.myDomain.com"); as well with no success. 回答1: I am having the