From 8b00f969cdbe33ed2f62f634beca3ffc608d2762 Mon Sep 17 00:00:00 2001 From: tsm-odoo Date: Mon, 20 Feb 2023 09:13:28 +0000 Subject: [PATCH] [FIX] deploy: add set_headers, fixing wrong $host value closes odoo/documentation#3635 X-original-commit: 8b92b734b29e17510b548ec30f2d899f0881da13 Signed-off-by: Antoine Vandevenne (anv) Signed-off-by: Stockbauer Matthieu (tsm) --- content/administration/install/deploy.rst | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/content/administration/install/deploy.rst b/content/administration/install/deploy.rst index 3e97714dd..629657f2e 100644 --- a/content/administration/install/deploy.rst +++ b/content/administration/install/deploy.rst @@ -309,12 +309,6 @@ in ``/etc/nginx/sites-enabled/odoo.conf`` set: proxy_connect_timeout 720s; proxy_send_timeout 720s; - # Add Headers for odoo proxy mode - proxy_set_header X-Forwarded-Host $host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Real-IP $remote_addr; - # SSL parameters ssl_certificate /etc/ssl/nginx/server.crt; ssl_certificate_key /etc/ssl/nginx/server.key; @@ -340,6 +334,11 @@ in ``/etc/nginx/sites-enabled/odoo.conf`` set: # Redirect requests to odoo backend server location / { + # Add Headers for odoo proxy mode + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Real-IP $remote_addr; proxy_redirect off; proxy_pass http://odoo; } @@ -429,6 +428,11 @@ by intercepting all requests to :samp:`/{MODULE}/static/{FILE}`, and looking up # Serve static files right away location ~ ^/[^/]+/static/.+$ { + # Add Headers for odoo proxy mode + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Real-IP $remote_addr; root /usr/lib/python3/dist-packages/odoo/addons; try_files $uri @odoo; expires 24h;