Mixed Content/SSL Redirect Error when Setting Up NopCommerce 4.2 on Ubuntu

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 年 前
To install NopCommerce on an Azure VM running Ubuntu, I ran through the steps here (https://docs.nopcommerce.com/en/user-guide/installing/linux.html) and am able to get the base install working well without issue.

I'm trying to add SSL to the site, and running into the Mixed Content/Redirect issue - I was able to get a cert using Let's Encrypt:

If I do not turn on "SSL Enabled" for the store, I get a mixed content warning, but when I turn on "SSL Enabled", I end up with a redirect loop. I can't tell if it's how I have NGINX configured (configuration below) or

Site is available here: https://nopex.eastus.cloudapp.azure.com/

Checked "Force SSL for all site pages"

Changed appsettings.json to the following:
"Hosting": {
    //Set to "true" the settings below if your hosting uses a load balancer$
    "UseHttpClusterHttps": true,
    "UseHttpXForwardedProto": true,


NGINX configuration:

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    server_name   nopex.eastus.cloudapp.azure.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/nopex.eastus.cloudapp.azure.com/f$
    ssl_certificate_key /etc/letsencrypt/live/nopex.eastus.cloudapp.azure.c$
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
4 年 前
Figured out the error - when I see the following in appsettings.json while having NGINX redirect HTTPS, I got everything working:


"Hosting": {
    //Set to "true" the settings below if your hosting uses a load balancer$
    "UseHttpClusterHttps": false,
    "UseHttpXForwardedProto": true,
4 年 前
dfar wrote:
Figured out the error - when I see the following in appsettings.json while having NGINX redirect HTTPS, I got everything working:


"Hosting": {
    //Set to "true" the settings below if your hosting uses a load balancer$
    "UseHttpClusterHttps": false,
    "UseHttpXForwardedProto": true,

Thanks for sharing the details. Just one question, do you use the sqlserver as database or anything else.
4 年 前
Yes - specifically I use Azure SQL Database (the guide shows how to set up SQL Server on the VM, but I just opted to use the managed Azure solution)
3 年 前
@ dfar
Thanks a lot, you saved me weeks to find out how to remove the mixed content.

Jean
3 年 前
Thanks!

Finally got a site up and running on an Azure Kubenetes cluster today and ran into the same problem.
3 年 前
Thank you very much! It's save my day :D
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.