Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caddy Reverse Proxy not working #79

Open
samcro1967 opened this issue Oct 10, 2019 · 4 comments
Open

Caddy Reverse Proxy not working #79

samcro1967 opened this issue Oct 10, 2019 · 4 comments

Comments

@samcro1967
Copy link

I am running airsonic in a Docker container with URL base set as airsonic.

CADDYFILE

  • Internal access to localhost only works when "without /airsonic" is used
https://mydomain.net/ http://localhost/ {
    proxy / 192.168.1.103:4040/airsonic {          # https://github.com/airsonic/airsonic
    transparent
	without /airsonic
  }
}

https://mydomain.net gets redirected to http//mydomain.net after I provide valid user name and password. Seems like Airsoni is redirecting HTTPS traffic to HTTP which is not configured in Caddy or allwed through the firewall.

Hoping I am missing something simple.

Airsonic log file
airsonic.log

@jooola
Copy link
Contributor

jooola commented Oct 11, 2019

You might want to try with some forward headers :

Here is what I found, not sure how cddy works, but you could try it (you need to replace host with something, not sure if you can get the host dynamically).

header_upstream X-Forwarded-Proto https
header_upstream X-Forwarded-Host <host>

Would you mind sharing your configuration once you have a working setup ? Even bettre would be to open a PR on the airsonic-docs repo with your configuration !

@samcro1967
Copy link
Author

samcro1967 commented Oct 12, 2019

The transparent command for Caddy does all of that already if I am understanding the documentation correctly:

transparent - Passes thru host information from the original request as most backend apps would expect. Shorthand for:

header_upstream Host {host}
header_upstream X-Real-IP {remote}
header_upstream X-Forwarded-For {remote}
header_upstream X-Forwarded-Port {server_port}
header_upstream X-Forwarded-Proto {scheme}

@samcro1967
Copy link
Author

Found some documentation I missed in the inital setup. This solved the issue.

You will also need to make sure Tomcat uses the correct headers for redirects. Stop your Airsonic server or docker image and:

nano /path/to/airsonic/config/airsonic.properties
Add the following line to the bottom of the file:

server.use-forward-headers=true

https://airsonic.github.io/docs/proxy/caddy/

@jvoisin jvoisin transferred this issue from airsonic/airsonic Oct 17, 2019
@jvoisin jvoisin reopened this Oct 17, 2019
@hayalci
Copy link

hayalci commented Feb 19, 2021

Looks like this issue was accidentally reopened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants