SelfhostedPro / Yacht

A web interface for managing docker containers with an emphasis on templating to provide 1 click deployments. Think of it like a decentralized app store for servers that anyone can make packages for.
MIT License
3.32k stars 158 forks source link

[Bug Report] Reverse Proxy Issue #441

Closed joeychrys closed 4 weeks ago

joeychrys commented 2 years ago

Issue: Currently I am trying to place a Yacht container behind a reverse proxy that is managed by Nginx. I'm doing this in order to not expose any ports other than port 80. The problem seems to be when Yacht makes a GET request to the sub-directory: /api/apps/stats. This request returns a 404 error implying it can't be found.

Reason: I believe the issue might be in Yacht's Nginx configuration. The absolute path used in the reverse proxy to the Fast API server could be the problem.

Solution: I am able to get around this by creating an additional reverse proxy to /api/ in my nginx.conf file.

Docker Network:

My Nginx Config File:

upstream django_apps {
    server django:8000;
}

upstream yacht {
    server yacht:8000;
}

map $http_upgrade $connection_upgrade {
    default upgrade;
    '' close;
}

server {

    listen 80;
    server_name localhost;

    location / {
        proxy_pass http://django_apps;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect off;
    }

    location /yacht/ {
    proxy_pass http://yacht/;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    }

    # With out the below reverse proxy, /api can not be found.
    location /api {
    proxy_pass http://yacht;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    }
}

Side Note: Yacht is awesome :)

SelfhostedPro commented 2 years ago

Thanks for reporting this. I’ll take a look and see if I can get that working. In the meantime, you should be able to use a subdomain. Thanks!

joeychrys commented 2 years ago

Thanks for reporting this. I’ll take a look and see if I can get that working. In the meantime, you should be able to use a subdomain. Thanks!

Thank you. Will do!

jonand commented 1 year ago

I hit this same bug. The subdomain workaround still works, but I'd prefer not needing a workaround.

wickedyoda commented 1 year ago

I will check on and post any updated we have; in the meantime, try pulling the :devel build and see if the problem is resolved. There have been a lot of fixes implemented but not pushed to the latest yet. Even several on the :nightly repo.

Please update after testing. @jonand @joeychrys

jonand commented 1 year ago

I gave :devel and :nightly a try, but still couldn't get through the login without the workaround.

nikoksr commented 1 year ago

+1 for this.

francesquini commented 1 year ago

Hit this same bug today. Any news on a possible fix? (workaround still works)

wickedyoda commented 1 year ago

A new version of yacht is in the works, I tried duplicating the issue and wasn't able to. Please post and updated screenshots, logs or other info you have and will try to dig deeper into it.

Thanks!

francesquini commented 1 year ago

I was using v0.0.7-alpha-2023-01-12--05. I'll try the latest version from git asap and will let you know if the problem persists.

Tks

wickedyoda commented 1 year ago

Not sure if it's you or not, we have 2 users in our discord currently working with setting up yacht, portainer, and a couple apps with reverse proxies. It might be beneficial if you can join and we all can work on configs in one place.

Joystick01 commented 1 year ago

@joeychrys Thank you for the workaround, this also works with nginx proxy manager. The bug was driving me crazy.

wickedyoda commented 1 year ago

Check out http://dev.yacht.sh for updated proxy directions.