How to run Docker container on a subfolder behind Nginx proxy?

Hello all,
We are very interested to move the roadmap of Sonerezh on Wekan and I’d like to use the Docker image behind a Nginx reverse proxy, on a subfolder ( to be precise).

So I followed the documentation on the Docker hub and run the Wekan container as this:

$ docker run -d --link wekan-db:db -e 'MONGO_URL=mongodb://db' -e 'ROOT_URL=' -p 8081:80 --name wekan-test mquandalle/wekan

The container seems to work properly:

$ curl -I
HTTP/1.1 200 OK
Vary: Accept-Encoding
Content-Type: text/html; charset=utf-8
Date: Thu, 24 Sep 2015 20:33:06 GMT
Connection: keep-alive

And here is my Nginx configuration to proxify all the requests from /roadmap/ to the container:

server {
    # [...]
  location /roadmap/ {
        try_files $uri $uri/ @wekan-docker;

        location ~ ^/roadmap/(.+\.(css|js|jpg|jpeg|png|woff))$ {
            try_files $uri $uri/ @wekan-docker;

    location @wekan-docker {
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

May be I am using Nginx in a wrong way, but you can see the result here : The CSS and JS files are loaded, but if you click on “sign-in” you are redirected to /sign-in instead of /roadmap/sign-in and the Wekan logo is not displayed.

I would be very grateful if you could help me, we could find the good way to do this. I’m running Nginx 1.9.4 and Docker 1.6.2 on Debian 8.2.

Edit: well… The redirection to /sign-in seems to work. But it sould not :confused: …If you refresh the page you have 404 error.

Hi Guillaume,

I haven’t looked in the details of the Nginx configuration but there is a high chance that the issue comes from the use of ROOT_URL= The router we use (flow-router for Meteor) doesn’t handle the subpath defined in the ROOT_URL environment variable as it should. This is an issue quite a few people have encountered, here or here for instance.

I’ve been working on a fix for flow-router, so hopefully this issue will get fixed in the next Wekan release. Unfortunately I can’t think of any short term hacky solution.

Thank you for help, so I’ll try to run the container on a dedicated subdomain instead.
Thanks for this beautiful and very usefull webapp! :slight_smile: