Magento + Turpentine + SSL only generates HTTP URL

I am pulling my hair out due to this problem, so I am very grateful for the help: /

I am using Turpentine with Magento 1.7 CE and Varnish 3 which works great. Now I wanted to add SSL encryption, which doesn't work that well.

SSL encryption is completed by Pound (listening on 443), then the data is fed to varnish (listening on 6081) and finally nginx (8080). The problem is that all generated URLS (links to products, categories and ...) are generated using HTTP, not HTTPS.

I tried to set the unsecured base url to https, but that completely broke my site (I had a 404 '' embed loop that never stopped loading).

SSL offloading seems to work because all resources are loaded using HTTPS (if I get confused about setting up SSL offloading in Magento I get mixed content warnings).

phpinfo tells me about HTTPS:

[...]
_SERVER["HTTPS"] on
_SERVER["HTTP_SSL_OFFLOADED"] 1
[...]

      

My config:

Magento (the most important parts I think):

Auto-redirect to Base URL: No
Use Web Server Rewrites: Yes
Unsecure Base URL: http://myurl.com
Secure Base URL: https://myurl.com
Use Secure URLs in Frontend: Yes
Offloader Header: HTTP_SSL_OFFLOADED

      

Pound:

ListenHTTPS
    Address 0.0.0.0
    Port    443
    Cert    "/path/to/my/cert.pem"
    xHTTP   2
    RewriteLocation 1
    Ciphers "RC4:!SSLv2:!ADH:!aNULL:!eNULL:!NULL:!LOW:!EXP"
    AddHeader "Ssl-Offloaded: 1"
End

Service
    BackEnd
        Address 127.0.0.1
        Port    6081
    End
End

      

Varnish uses Turpentine-Config (which works fine without SSL)

Nginx:

server {
        listen 8080 default_server;

        root /var/www/mysite.at;

        index index.php;

        server_name _;

        location / {
                try_files $uri $uri/ /index.php;
        }
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
                root /usr/share/nginx/www;
        }


        location ~ \.php$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;

                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;

                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
               fastcgi_param HTTPS on;
        }

        location ~ /\.ht {
                deny all;
        }
}

      

I'm really out of ideas: (I'd love to provide more details on my config if needed).

+3


source to share


1 answer


It turned out that I had several problems.

  • nginx config for "location /":

    location / {
            try_files $uri $uri/ @handler;
    }
    
    location @handler {
            rewrite / /index.php;
    }
    
          

Without this, no ajax calls will work.



  1. Insecure base url in Magento config must include "https"

  2. Turpentine should use the ESI HTTP URL, not HTTPS. The required changes are shown in this commit:

https://github.com/eth8505/magento-turpentine/commit/575f499382217f0013eaf097fd79ceddec0b4381

+1


source







All Articles