[GH-ISSUE #921] koel behind nginx proxy #596

Closed
opened 2026-02-26 02:33:39 +03:00 by kerem · 2 comments
Owner

Originally created by @bugsyb on GitHub (Feb 24, 2019).
Original GitHub issue: https://github.com/koel/koel/issues/921

@phanan many thanks for great piece of software, amazing look and feel.

Problem I'm facing is I can't get it working behind nginx proxy.

Koel is in docker (https://hub.docker.com/r/binhex/arch-koel/) and works fine when accessed on exposed port (8050) in my case.

I've frontend set up for multiple apps on same system and use similar nginx reverse proxy setup.
For whatever reason I couldn't get it working for Koel.
Apps often need to have set base url and thought in case of Koel it is:

.env

APP_URL=http://localhost
I did set it to http://myhost.vpn/koel

At the same time nginx part of config looks like this (typical):

location /koel {
    proxy_pass http://127.0.0.1:8050;
    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 Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
}

I've also tried with variation of parameters:

#location /koel {
#    proxy_pass http://127.0.0.1:8050/;
##    proxy_http_version        1.1;
##    proxy_redirect    off;
##    proxy_set_header  Host $host:8050;
#    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;
##    proxy_set_header  X-Forwarded-Host $server_name;
##    proxy_set_header  X-Forwarded-Server $host;
##    proxy_set_header Upgrade $http_upgrade;
##    proxy_set_header Connection "upgrade";
#


location /koel{
    proxy_pass http://localhost:8050;
    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;
    proxy_redirect http://localhost:8050 $scheme://myhost.vpn/;
}

Maybe I've just missed the right combination of parameters? Sorry, I'm not expert in nginx and Laravel apps.

Would be great to have examples in docs. Majority of them is about Apache, but it proves that Koel should be friendly with reverse proxying.

Thanks for help.

Other sources I've checked already:
https://github.com/NairVish/koel-docker
https://gist.github.com/simonsmiley/5fb92bc0086ed06e1e8b74547c02d421
https://github.com/phanan/koel/issues/255
https://github.com/phanan/koel/issues/74
https://github.com/vmario89/koel-music-setup

Originally created by @bugsyb on GitHub (Feb 24, 2019). Original GitHub issue: https://github.com/koel/koel/issues/921 @phanan many thanks for great piece of software, amazing look and feel. Problem I'm facing is I can't get it working behind nginx proxy. Koel is in docker (https://hub.docker.com/r/binhex/arch-koel/) and works fine when accessed on exposed port (8050) in my case. I've frontend set up for multiple apps on same system and use similar nginx reverse proxy setup. For whatever reason I couldn't get it working for Koel. Apps often need to have set base url and thought in case of Koel it is: # .env APP_URL=http://localhost I did set it to http://myhost.vpn/koel At the same time nginx part of config looks like this (typical): ``` location /koel { proxy_pass http://127.0.0.1:8050; 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 Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } ``` I've also tried with variation of parameters: ``` #location /koel { # proxy_pass http://127.0.0.1:8050/; ## proxy_http_version 1.1; ## proxy_redirect off; ## proxy_set_header Host $host:8050; # 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; ## proxy_set_header X-Forwarded-Host $server_name; ## proxy_set_header X-Forwarded-Server $host; ## proxy_set_header Upgrade $http_upgrade; ## proxy_set_header Connection "upgrade"; # ``` ``` location /koel{ proxy_pass http://localhost:8050; 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; proxy_redirect http://localhost:8050 $scheme://myhost.vpn/; } ``` Maybe I've just missed the right combination of parameters? Sorry, I'm not expert in nginx and Laravel apps. Would be great to have examples in docs. Majority of them is about Apache, but it proves that Koel should be friendly with reverse proxying. Thanks for help. Other sources I've checked already: https://github.com/NairVish/koel-docker https://gist.github.com/simonsmiley/5fb92bc0086ed06e1e8b74547c02d421 https://github.com/phanan/koel/issues/255 https://github.com/phanan/koel/issues/74 https://github.com/vmario89/koel-music-setup
kerem closed this issue 2026-02-26 02:33:39 +03:00
Author
Owner

@xordspar0 commented on GitHub (Apr 1, 2019):

What exactly doesn't work? It doesn't look like you're accessing Nginx via HTTPS, so it's probably not the same problem as #255.

Just a guess, but are you getting a 502 Bad Gateway when you try to access koel in your browser?

<!-- gh-comment-id:478699147 --> @xordspar0 commented on GitHub (Apr 1, 2019): What exactly doesn't work? It doesn't look like you're accessing Nginx via HTTPS, so it's probably not the same problem as #255. Just a guess, but are you getting a 502 Bad Gateway when you try to access koel in your browser?
Author
Owner

@phanan commented on GitHub (May 18, 2019):

Closing via 488854127a.

<!-- gh-comment-id:493706033 --> @phanan commented on GitHub (May 18, 2019): Closing via 488854127aa933ea21ab0f97213c663e11ae95cb.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/koel-koel#596
No description provided.