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:


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 help@domain.com
    ServerName dev.domain.com

    <IfModule rpaf_module>
        RPAFenable On
        RPAFsethostname On
        RPAFheader X-Forwarded-For

    DocumentRoot /home/sites/www/dev-domain/public 

    <Directory />
        Options FollowSymLinks
        AllowOverride None

    <Directory /home/sites/www/dev-domain/public/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all

    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

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

What am I missing?

  • Maybe this isn't apache fault. Did your web apps aware of X-Forwarded-Proto header? – masegaloeh Sep 15 '14 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? – Jenny D Sep 15 '14 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? – HBruijn Sep 15 '14 at 8:16
  • We don't use absolute URLs. It's all relative. So I'm a bit confused. – Tuinslak Sep 16 '14 at 5:39
  • @JennyD: Front-End-Https on; & X-Forwarded-Proto $scheme; – Tuinslak Sep 16 '14 at 5:40

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.

  • We use relative URLs. There are no http://domain.com links anywhere in our (laravel) website. – Tuinslak Sep 16 '14 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. – Kazimieras Aliulis Sep 16 '14 at 6:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.