You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by as...@apache.org on 2021/03/19 15:06:40 UTC

[airflow] 38/42: Suggest using $http_host instead of $host (#14814)

This is an automated email from the ASF dual-hosted git repository.

ash pushed a commit to branch v2-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit eab3b9e865b8fa143e6a17dc8d3c18860c8d7ec5
Author: Miguel Carbajo Berrocal <em...@gmail.com>
AuthorDate: Tue Mar 16 09:40:39 2021 -0400

    Suggest using $http_host instead of $host (#14814)
    
    If the reverse proxy is not running in port 80, using $host won't forward the port in the HTTP request to airflow and it won't build the correct redirect URL.
    
    E.g.
    I have nginx and airflow running in docker in the default ports. My mapping for nginx x is 7003:80.
    The request http://myserver:7003/myorg/airflow/ will redirect to http://myserver/myorg/airflow/admin/ instead of http://myserver:7003/myorg/airflow/admin/.
    
    (cherry picked from commit 9cb6553935c247fbfe23c7584dd4d9f579c6bf55)
---
 docs/apache-airflow/howto/run-behind-proxy.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/apache-airflow/howto/run-behind-proxy.rst b/docs/apache-airflow/howto/run-behind-proxy.rst
index eea0eb7..2901ed0 100644
--- a/docs/apache-airflow/howto/run-behind-proxy.rst
+++ b/docs/apache-airflow/howto/run-behind-proxy.rst
@@ -47,7 +47,7 @@ Your reverse proxy (ex: nginx) should be configured as follow:
 
         location /myorg/airflow/ {
             proxy_pass http://localhost:8080;
-            proxy_set_header Host $host;
+            proxy_set_header Host $http_host;
             proxy_redirect off;
             proxy_http_version 1.1;
             proxy_set_header Upgrade $http_upgrade;
@@ -64,7 +64,7 @@ Your reverse proxy (ex: nginx) should be configured as follow:
           location /myorg/flower/ {
               rewrite ^/myorg/flower/(.*)$ /$1 break;  # remove prefix from http header
               proxy_pass http://localhost:5555;
-              proxy_set_header Host $host;
+              proxy_set_header Host $http_host;
               proxy_redirect off;
               proxy_http_version 1.1;
               proxy_set_header Upgrade $http_upgrade;