mercredi 24 avril 2019

(CORS header ‘Access-Control-Allow-Origin’ missing) error is thrown after 10 HTTP requests

I have added CORS headers to nginx server to allow requests from different origin.

ngx.header["Access-Control-Allow-Origin"] = "*" ngx.header["Access-Control-Request-Method"] = "POST, GET, OPTIONS" ngx.header["Access-Control-Allow-Methods"] = "GET, HEAD, POST, PUT, OPTIONS" ngx.header["Access-Control-Request-Headers"] = "content-type, X-API-Key" ngx.header["Access-Control-Allow-Headers"] = "content-type, X-API-Key"

The GET get successful(200 OK) for some 8 requests, at the 9th HTTP request it throws an internal server error(503), with the below error in console.

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://192.168.0.1/api/v1. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).




Aucun commentaire:

Enregistrer un commentaire