0
I’m deploying an app made with nuxt.js. For hosting, I’m using the Digital Ocean + Server Pilot.
I’m having trouble forcing the redirect of HTTP for HTTPS. Below is the configuration Nginx that I’m wearing.
map $sent_http_content_type $expires {
"text/html" epoch;
"text/html; charset=utf-8" epoch;
default off;
}
server {
listen 80;
server_name admin.domain.com;
gzip on;
gzip_types text/plain application/xml text/css application/javascript;
gzip_min_length 1000;
location / {
expires $expires;
proxy_redirect off;
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_read_timeout 1m;
proxy_connect_timeout 1m;
proxy_pass http://127.0.0.1:3000;
}
}
server {
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
ssl_certificate_key ssl/_default.key;
ssl_certificate ssl/_default.crt;
return 444;
}
Access https://admin.domain.com
, it works; if you access http://admin.domain.com
, it does not redirect to https and I get a "not safe" sign, the little red chair
NOTE: I would like to configure/resolve this block
server
, because in the future I will have other servers, for exampleblog.domain.com