Want caddy redirection rule

You definitely need a forward slash / not a backslash \, but yes, you’re right, you need a * as your request matcher for the rewrite, otherwise the leading / gets taken as being the path matcher.

1 Like

changed the slashes, should I mark it as the last comment as solution?

  • also one last thing, now my config is
*.xamyr.com {
  rewrite * /{labels.2}{uri}
  reverse_proxy localhost:3000
}

I want it to be http not https, what are the lines to add

Just put http:// in front.

1 Like
alpha.xamyr.com {
  rewrite * /{labels.2}{uri}
  reverse_proxy localhost:3000
}

there is another issue, everything work as suggested if there is something after /

https://alpha.xamyr.com/admin ==
proxies ~ https://xamyr.com/alpha/admin
# works perfectly

but if it is just https://alpha.example.com, it automatically redirects to https://alpha.example.com/alpha

https://alpha.xamyr.com !=
redirects to ~ https://alpha.xamyr.com/alpha
# doesn't work

I’m not sure I really understand, but the redirect is probably being performed by your upstream app.

This topic was automatically closed after 30 days. New replies are no longer allowed.