[Fixed]-Django: How can I access celery flower page in production mode?

11👍

you need change flower nginx conf to:

location ~ ^/flower/? {
    rewrite ^/flower/?(.*)$ /$1 break;

    sub_filter '="/' '="/flower/';
    sub_filter_last_modified on;
    sub_filter_once off;

    # proxy_pass http://unix:/tmp/flower.sock:/;
    proxy_pass http://localhost:5555;
    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_http_version 1.1;
}
👤neonua

6👍

Actually you’ll need both previous solutions at the same time:

  1. Run flower with –url-prefix=flower as @osmay88 mentioned
  2. Configure Nginx location section in next manner:

    location ~ ^/flower/? {
        proxy_pass http://<IP>:<PORT>;
        rewrite ^/flower/?(.*)$ /$1 break;
    }
    

When in use without url-prefix but with sub_filter then this will cause “Monitor” page to be empty.

4👍

you can run flower with –url-prefix=flower

4👍

from doc

$ flower --url_prefix=flower

nginx.conf

location /flower/ {
    rewrite ^/flower/(.*)$ /$1 break;
    proxy_pass http://example.com:5555;
    proxy_set_header Host $host;
}

Leave a comment