I have CORS problem that did not exist until today morning. It happened probably after I updated my nginx on my Ubuntu server. I've always had in my express server the following code:
this.express.use(function(req, res, next) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Methods", "GET,HEAD,OPTIONS,POST,PUT"); res.header( "Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization" ); next(); }); } And it worked perfectly. Now suddenly I get prerequest error, as you can see here. The weird thing is - you need to refresh multiple times, eventually you'll get it. It's like 20% of the time, and the other 80% it works fine. https://my.treedis.com/public/asset/jtmDerKhYqV
My nginx configuration is as follows:
location / { proxy_pass http://localhost:5030; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } For example firs time i tried to fetch and it failed due to CORS:
And then another time I tried actually worked, same resource:

