airflow-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergei Iakhnin <lle...@gmail.com>
Subject Re: Airflow behind reverse proxy
Date Tue, 19 Dec 2017 09:55:53 GMT
Take a look at this PR -
https://github.com/apache/incubator-airflow/pull/2723#issuecomment-350356492

On Tue, Dec 19, 2017 at 9:49 AM Andreas Koeltringer <
andreas.koeltringer@n-fuse.co> wrote:

> Hello everybody,
>
> I am wondering whether Airflow uses absolute links to get its static
> content?
> I am trying to put Airflow behind a nginx proxy into a subdirectory. I
> get the following situations:
>
> ## Case 1: forward root directory
>
> ### nginx.conf
>
> ```
> location / {
>      proxy_pass http://localhost:17000/;
> }
> ```
>
> ### Result
>
> * this works, but does not use the desired subdirectory...
>
>
> ## Case 2: forward airflow directory - simple
>
> ### nginx.conf
>
> ```
> location /airflow/ {
>      proxy_pass http://localhost:17000/;
> }
> ```
>
> ### Result
>
> * the html/main page gets fetched ok
> * the browser console shows that it tries to fetch static content from
>    ``server_url/static`` instead of ``server_url/airflow/static``
> * a ``curl server_url/airflow/static/main.css`` works
>
>
> ## Case 3: forward airflow directory - advanced
>
> ### nginx.conf
>
> ```
> location /airflow/ {
>      proxy_pass http://localhost:17000/;
>
>      proxy_set_header X-Real-IP $remote_addr;
>      proxy_set_header Host $host;
>      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>      proxy_set_header X-Forwarded-Proto $scheme;
> }
> ```
>
> ### Result
>
> * url in browser changes to ``server_url/admin`` instead of
> ``server_url/airflow/admin``
> * nginx returns a ``404 Not found``
>
>
> ## Workaround
>
> rewrite "static" urls, together with the configuration from Case 2:
> ```
> rewrite ^/(static|admin|api)/(.*) /airflow/$1/$2;
> ```
>
> This fixes the above issues, but is "hacky". Is there a better solution?
> Is this a bug? Am I missing something? Thanks in advance!
>
>
>
> --
> Andreas Koeltringer
> Mail:   andreas.koeltringer@n-fuse.co
>
> --

Sergei

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message