I'm using DRF (+ corsheaders) port 8000, React port 3000 and on VPS nginx. All start in terminal manually.
Without SSL all works ok.
After I add SSL certificate to my project on ubuntu VPS, I start to receive next error message after any request - "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://127.0.0.1:8000/api/one/. Reason: CORS request did not succeed). Status code: (null)".
I find that it is next error type: "Trying to access an http resource from a page with an https origin will also cause this error."
Please help how to set nginx config to solve this issue
Nginx:
server {
listen 80;
server_name mysite.com www.mysite.com;
return 301 https: //mysite.com$request_uri;
}
server {
listen 443 ssl;
server_name mysite.com www.mysite.com;
ssl_certificate /etc/letsencrypt/live/mysite.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/mysite.com/privkey.pem;
location / {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
I tried a lot configurations I have find, but result didn't changed.
Maybe I'm looking in wrong place, I mean, to make changes in another settings file