How Fix Mixed Content | proxypass nginx

Need help? Post your questions here.
User avatar
3tcetera
Posts: 6
Joined: 22 Nov 2014, 20:09
Location: Another french guy who need to learn English :D
Has thanked: 14 times
Been thanked: 5 times

How Fix Mixed Content | proxypass nginx

Unread post by 3tcetera » 07 Aug 2015, 20:05

Hello,

How i have some trouble for redirect my http://sub.domaine.tld to https://sub.domaine.tld . I use nginx with proxypass on a Debian jessie (server) and java version "1.8.0_51, a domain name + certficat ssl signed by startssl :

/etc/nginx/sites-enabled/madsonic.conf

Code: Select all

# cat /etc/nginx/sites-enabled/madsonic.conf 

upstream madsonic {
  server 127.0.0.1:4040;
}

server {
  listen                     80;
 	server_name                sub.domaine.tld;
        return 301 https://$server_name$request_uri;
}

server {
  listen 443 ssl;
  server_name sub.domaine.tld;
  client_max_body_size 200M;
    
   ssl on;
    ssl_certificate /etc/nginx/keys/domaine.ltd.crt-unified;
    ssl_certificate_key /etc/nginx/keys/domaine.ltd.key;
  include /etc/nginx/conf.d/ciphers.conf;
	
        access_log /var/log/nginx/madsonic-access.log combined;
	error_log /var/log/nginx/madsonic-error.log error;

    # proxy to madsonic app
  location / {
    proxy_pass http://127.0.0.1:4040;
    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header  X-Forwarded-Server $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-Host $server_name;
  }

}

/etc/default/madsonic

Code: Select all

# cat /etc/default/madsonic

MADSONIC_ARGS="--init-memory=512 --max-memory=1024 --default-upload-folder=/home/USER/media/incoming --default-podcast-folder=/home/USER/media/podcast --default-playlist-import-folder=/home/USER/m$

MADSONIC_USER=USER

https for only listen music work fine because this no required to call a js script.
But the problem is when would eg. edit settings or any other action who need to call a js script, my browser ( FF or Chromiun ) block the script because : Mixed Content
There is no rules to rewrite this in https :roll:
Mixed Content: The page at 'https://sub.domaine.ltd/index.view' was loaded over HTTPS, but requested an insecure resource 'http://sub.domaine.ltd/musicFolderSettings.view'. This request has been blocked; the content must be served over HTTPS.
Is here a way to fix this ?

THX
3tc
Another french guy who need to learn english

kiv
Posts: 2
Joined: 25 Nov 2015, 11:13
Has thanked: 0
Been thanked: 0

Re: How Fix Mixed Content | proxypass nginx

Unread post by kiv » 27 Nov 2015, 14:20

I have exactly the same problem and no solution to solve this.

For the moment I just told firefox to show mixed content : "about:config, and turn off the

Code: Select all

security.mixed_content.block_active_content
I thought many people served their madsonic behind a reverse proxy and wrote solution for this, maybe I didn't search properly...

Yet another french guy struggling with english ;)

kiv
Posts: 2
Joined: 25 Nov 2015, 11:13
Has thanked: 0
Been thanked: 0

Re: How Fix Mixed Content | proxypass nginx

Unread post by kiv » 27 Nov 2015, 15:19

I think I have found a solution :

In your host, edit the nginx conf file of your VM or container : in location / {

Code: Select all

proxy_redirect http:// $scheme://;
And of course, reload nginx config ;)

Post Reply