SGaitskell wrote:The fix is to change your proxy to redirect any traffic from http://<your-ip>/ to https://your.domain.com/
For NGINX something like the following should work
if ($host != your.domain.com) {
return 301 https://your.domain.com$request_uri;
}
Actually using if statements is not a good idea according to nginx documentation
https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/#using-if you should use different server directives.
The following example configuration is from a Ubuntu 18.04 VPS running nopcommerce 4.30, nginx 1.18.0, certbot (for Let's Encrypt SSL). It redirects http requests (non-www, www, ip) to https with www in front of the domain name and https (non-www, ip) to https with www in front of the domain name:
server {
listen 80;
server_name example.com www.example.com xxx.xxx.xxx.xxx;
return 301 https://www.example.com$request_uri;
}
server {
listen 443 ssl;
server_name example.com xxx.xxx.xxx.xxx;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
return 301 https://www.example.com$request_uri;
}
server {
server_name www.example.com;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.com/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
}
If you follow the configuration above, you should use https and www as your store url (Configuration -> Stores -> Store URL -> https://www.example.com/), otherwise the automatic scheduled tasks fail (System -> Schedule Tasks) .