Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CORS: Firefox does not send POST Request after successful OPTIONS request … works in Chrome

I'm running into a similar issue as this post but the best answer did not help me out. If anybody has any other ideas, I would greatly appreciate it. Here are the requests:

Request Headers

OPTIONS

Access-Control-Request-Method:  POST
Access-Control-Request-Headers: content-type,x-annotator-auth-token,x-csrftoken

Response Headers

Access-Control-Max-Age: 3600
Access-Control-Allow-Origin:    http://localhost:8000
Access-Control-Allow-Methods:   GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS
Access-Control-Allow-Headers:   content-length, content-type, x-annotator-auth-token, x-requested-with, x-csrftoken
Access-Control-Allow-Credentials:   true

It returns with a status code of 200. The actual request contains content-length, content-type, x-annotator-auth-token, and x-csrftoken but gets no status code as if it never fired. Again any help would be appreciated! Thanks

like image 251
user3846446 Avatar asked Dec 19 '25 01:12

user3846446


1 Answers

response.addHeader("Access-Control-Allow-Origin", "*"); 

or

response.addHeader("Access-Control-Allow-Credentials","true");  

and

response.addHeader("Access-Control-Allow-Methods", "GET, PUT, POST, DELETE, OPTIONS");  
response.addHeader("Access-Control-Allow-Headers", "Content-Type, X-Experience-API-Version,Authorization");  
//add this into your response header and it will work
like image 174
Arun Avatar answered Dec 20 '25 18:12

Arun



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!