Skip to content

[Kamal 2] Redirections to internal host? #1031

Answered by jmonteiro
jmonteiro asked this question in Q&A
Discussion options

You must be logged in to vote

Found the issue. Doing some investigation on this tonight, I found the reason why that's happening:

On Kamal v1 (with Traefik), the following headers are passed to Rails:

  • SERVER_NAME: example.org
  • HTTP_HOST: example.org
  • HTTP_X_FORWARDED_HOST: example.org

On Kamal v2 (with Kamal-proxy), with the exact same application and environment, the following headers are passed to Rails:

  • SERVER_NAME: example.org
  • HTTP_HOST: example.org
  • HTTP_X_FORWARDED_HOST: pi1.example.org ⭐️

Notice that the HTTP_X_FORWARDED_HOST header is different when using Kamal v2, and that is causing the incorrect redirection. Bear in mind that the env is exactly the same, the only moving part is Kamal v1 vs v2.

My best gues…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@jmonteiro
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by jmonteiro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants