diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 76440afb4..dc680c97d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,5 +36,5 @@ jobs: - name: Run unit tests run: | python -m flower --version - python -m tests.unit.__main__ + python -m tests.unit diff --git a/docs/reverse-proxy.rst b/docs/reverse-proxy.rst index 6d7ee86a2..1542891de 100644 --- a/docs/reverse-proxy.rst +++ b/docs/reverse-proxy.rst @@ -5,22 +5,34 @@ Running behind reverse proxy To run `Flower` behind a reverse proxy, remember to set the correct `Host` header to the request to make sure Flower can generate correct URLs. -The following is a minimal `nginx` configuration: + +The following block represents the minimal `nginx` configuration: .. code-block:: nginx server { listen 80; server_name flower.example.com; - charset utf-8; location / { proxy_pass http://localhost:5555; - proxy_set_header Host $host; - proxy_redirect off; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; + } + } + +If you run Flower behind custom location, make sure :ref:`url_prefix` option +value equals to the location path. + +For instance, for `url_prefix` = **flower** (or **/flower**) you need the following +`nginx` configuration: + +.. code-block:: nginx + + server { + listen 80; + server_name flower.example.com; + + location /flower/ { + proxy_pass http://localhost:5555; } } diff --git a/examples/nginx.conf b/examples/nginx.conf index af9d7db3e..0dc35aa6b 100644 --- a/examples/nginx.conf +++ b/examples/nginx.conf @@ -1,11 +1,8 @@ server { - location /flower/static { - alias /the/path/to/flower/static; - } - location /flower { - rewrite ^/flower/(.*)$ /$1 break; + listen 80; + + # with url_prefix=`flower` + location /flower/ { proxy_pass http://localhost:5555; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header Host $host; } } diff --git a/flower/static/js/flower.js b/flower/static/js/flower.js index 992f0d65d..a1b2ea117 100644 --- a/flower/static/js/flower.js +++ b/flower/static/js/flower.js @@ -450,11 +450,8 @@ var flower = (function () { var total = api.column(column).data().reduce(sum, 0); var footer = total; if (total !== 0) { - footer = ''; + let queryParams = (state !== '' ? `?state=${state}` : ''); + footer = '' + total + ''; } $(api.column(column).footer()).html(footer); } diff --git a/flower/templates/navbar.html b/flower/templates/navbar.html index 23e4dff00..a55eb3767 100644 --- a/flower/templates/navbar.html +++ b/flower/templates/navbar.html @@ -1,6 +1,6 @@