https redirection not working correctly

Parzip nginx-forum at forum.nginx.org
Wed Dec 30 15:31:22 UTC 2015


Hello Kevin!
Thank you very much, but it's still not working....



## odoo backend ##
upstream odoo {
    server 127.0.0.1:8069;
}

## http redirects to https ##
server {
listen 80;
server_name *.XXXXX.ch www.XXXXX.ch XXXXX.ch;
return 301 https://$server_name$request_uri;
}



## https site##
server {
    listen      443 default;
    server_name *.XXXXX.ch XXXXX.ch www.XXXXX.ch;
    # root        /usr/share/nginx/html;
    # index       index.html index.htm;

    # log files
    access_log  /var/log/nginx/odoo-access.log;
    error_log   /var/log/nginx/odoo-error.log;

    # ssl files
    ssl on;
    ssl_certificate /etc/letsencrypt/live/XXXXX.ch/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/XXXXX.ch/privkey.pem;
    keepalive_timeout   60;

    # limit ciphers 
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_ciphers AES256+EECDH:AES256+EDH:!aNULL;
    

    # proxy buffers
    proxy_buffers 16 64k;
    proxy_buffer_size 128k;

    ## default location ##
    location / {
        proxy_pass  http://odoo;
        # force timeouts if the backend dies
        proxy_next_upstream error timeout invalid_header http_500 http_502
http_503 http_504;
        proxy_redirect off;

        # set headers
        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 https;
    }

    # cache some static data in memory for 60mins
    location ~* /web/static/ {
        proxy_cache_valid 200 60m;
        proxy_buffering on;
        expires 864000;
        proxy_pass http://odoo;
    }
}

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,263786,263792#msg-263792



More information about the nginx mailing list