By M Yahya
Hello everyone,
I have configured an app that communicated via websocket (ws) protocol.
I want to config this app over https but getting “mixed content error”:
** The app was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint.
Now I want to proxy https to http while enabling the SSL as well.
My current configs are:
server {
listen 443;
server_name verify.flexibilitaetsmarkt.de;
ssl_certificate /etc/letsencrypt/live/verify.flexibilitaetsmarkt.de/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/verify.flexibilitaetsmarkt.de/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
ssl on;
ssl_session_cache builtin:1000 shared:SSL:10m;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:8000;
proxy_read_timeout 86400;
}
}
server {
listen 8000;
root /home/ubuntu/alf_poc/app;
# Add index.php to the list if you are using PHP
index index.html;
}
However, I’m still getting the same error. Is there any help how can I proxy/redirect https to http and enable SSL as well?
Many thanks
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi there @myahya,
As per the official Nginx documentaton, what I could suggest trying is to add the following extra proxy rules:
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
After that run a config test:
- sudo nginx -t
And if you get Syntax OK, restart Nginx:
- sudo systemctl restart nginx
Let me know how it goes! Regards, Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.