From 91f24abdf5c6caac17216ab74c27a678b629461a Mon Sep 17 00:00:00 2001 From: Julien Castiaux Date: Fri, 8 Dec 2023 13:20:10 +0000 Subject: [PATCH] [FIX] deploy: nginx forwarded-host with tcp port Install nginx using the nginx configuration found in the documentation and changes the `listen` port to 8080. Start Odoo in `--proxy-mode`. listen 8080; server_name mycompany.odoo.com; 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; location / { proxy_pass http://127.0.0.1:8069; } Inside your browser, access "http://mycompany.odoo.com:8080" you are wrongly redirected to "http://mycompany.odoo.com:80". Odoo uses the `X-Forwarded-Host` http header value to generate new URls, in this configuration `$host` only contains the domain (=hostname using the urllib terminology) instead of the domain+port (=netloc). The variable that contains both the domain and the port is actually `$http_host`. closes odoo/documentation#6942 Closes: odoo/odoo#64643 X-original-commit: 09c42c5896ce9ff95c40110a6f72316705cf4316 Signed-off-by: Antoine Vandevenne (anv) Signed-off-by: Julien Castiaux (juc) --- content/administration/install/deploy.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/administration/install/deploy.rst b/content/administration/install/deploy.rst index d43e17260..9cc26da7b 100644 --- a/content/administration/install/deploy.rst +++ b/content/administration/install/deploy.rst @@ -330,7 +330,7 @@ in ``/etc/nginx/sites-enabled/odoo.conf`` set: proxy_pass http://odoochat; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; - proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Host $http_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; @@ -339,7 +339,7 @@ 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-Host $http_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;