Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1820

nginx redirect http to https on localhost

$
0
0

I'm testing nginx locally as a reverse proxy

I want to redirect wildcard subdomain http to https

The subdomains are handled programmatically in the application

    server {        listen         80;        server_name ~^(.*)\.localhost$;        return 301 https://$server_name$request_uri;    }    server {        listen  443 ssl;        gzip on;        gzip_comp_level 6;        gzip_vary on;        gzip_min_length  1000;        gzip_proxied any;        gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;        gzip_buffers 16 8k;         server_name ~^(.*)\.localhost$;        # SSL Certs        ssl_certificate /path/to/server.crt;        ssl_certificate_key /path/to/server.key;        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;        location / {            proxy_pass http://localhost:3333;            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;        }    }

accessing https directly from the chrome works fineaccessing http does literally nothing, not even a page refresh


Viewing all articles
Browse latest Browse all 1820

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>