I have used self-signed certificate in nginx. The request from UI(React js) is hitting in the backend, but NGINX is not passing the headers to the backend. My nginx configuration file is as follow:
server {
listen 443 ssl;
ssl on;
server_name SERVER_NAME;
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
#add_header Strict-Transport-Security max-age=31536000;
add_header Cache-Control no-cache;
location / {
root PATH_TO_FRONTEND;
try_files $uri $uri/ /index.html$is_args$args;
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;
}
location ~* api/(.*) {
proxy_pass http://127.0.0.1:8080$request_uri; // BACKEND
proxy_redirect off;
proxy_set_header Host $host;
add_header Cache-Control no-cache;
} }
I get the following error in the browser:
An SSL certificate error occurred when fetching the script.
sw.js Failed to load resource: net::ERR_INSECURE_RESPONSE
login:1 Uncaught (in promise) DOMException: Failed to register a ServiceWorker: An SSL certificate error occurred when fetching the script.