0

I have an UWSGI application and a Celery/Flower task worker/monitor. They are deployed on Azure App Service as a multi-container application.

Locally I am routing jobs to the worker by using "HOST: worker" in the HTTP request. The task monitor is set as default_server. Both are listening on port 80, since Azure App Service only allows exposing port 80/443. Everything works fine locally (using docker-compose). However, when deployed to Azure App Service, the routing of the request does not work and Azure App Service returns a 404 error with a recommendation to set up a custom domain.

What are my options for fixing this without setting up a custom domain.

Here is my nginx.conf

    server {
        listen 80;
        server_name worker;

        location / {
            include uwsgi_params;
            uwsgi_pass flask:5001;
        }
    }
    server {
    listen 80 default_server;
    server_name monitor;


    charset utf-8;

    location / {
        proxy_pass http://monitor: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";
    }
}
lammy
  • 101
  • 1

1 Answers1

0

I eventually solved the issue by routing requests based on location. Note that the location has been changed to avoid conflicting with the internal routing of the backend application.

server {
    listen 80 default_server;
    charset utf-8;
    location / {
        proxy_pass http://monitor0: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";
    }
    location /worker0/ {
        include uwsgi_params;
        uwsgi_pass flask:5001;
    }
}
lammy
  • 101
  • 1