0

I am running the following setup:

[public ip]-nginx_proxy-[lan]-apache_server

SSL is configured and set up on the nginx proxy level (and this is working).

However, when I visit a site over ssl, I get .css and .js files returned over http (which are blocked by the browser). It seems like Apache is unaware that the client is requesting content over ssl.

This is my current config:

nginx:

server { listen 443; server_name maiev.domain.com, ~.; ssl on; ssl_certificate /etc/nginx/ssl/domain.pem; ssl_certificate_key /etc/nginx/ssl/domain.pem; access_log off; error_log off; location ~ /\.ht { deny all; } location ~ /\.git { deny all; } location / { proxy_pass http://maiev.local:80; 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; add_header Front-End-Https on; proxy_redirect off; } } 

This is my Apache config:

<VirtualHost *:80> ServerAdmin [email protected] ServerName dev.domain.com <IfModule rpaf_module> RPAFenable On RPAFsethostname On RPAFproxy_ips 172.16.1.130 RPAFheader X-Forwarded-For </IfModule> DocumentRoot /home/sites/www/dev-domain/public <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /home/sites/www/dev-domain/public/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ErrorLog /home/sites/logs/dev-domain/error.log LogLevel warn CustomLog /home/sites/logs/dev-domain/access.log combined php_value log_errors on php_value error_log /home/sites/logs/dev-domain/php.log </VirtualHost> 

If I change the $scheme to https in the nginx config, nothing changes.

What am I missing?

5
  • Maybe this isn't apache fault. Did your web apps aware of X-Forwarded-Proto header? Commented Sep 15, 2014 at 8:11
  • How exactly would you expect apache to know that you're using SSL when you're handling the SSL outside of apache? Commented Sep 15, 2014 at 8:11
  • And it is not the actual content that references the .css and .js using absolute URL's (using plain HTTP) instead of relative ones? Commented Sep 15, 2014 at 8:16
  • We don't use absolute URLs. It's all relative. So I'm a bit confused. Commented Sep 16, 2014 at 5:39
  • @JennyD: Front-End-Https on; & X-Forwarded-Proto $scheme; Commented Sep 16, 2014 at 5:40

1 Answer 1

0

If you set your url to 'http://...' in your html file, it will be used as http, not converted to https magically because referrer is using https. So your probably need to fix your application and not you web server.

2
  • We use relative URLs. There are no http://domain.com links anywhere in our (laravel) website. Commented Sep 16, 2014 at 5:38
  • Check with some developer tools, what urls are loaded. There might be some images requested from css or some js loading some http url, that you did not accounted for. Commented Sep 16, 2014 at 6:41

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.