Redirect to domain working weird

Yet another weird behavior. Docs claim you can omit from from redir.

However, while this works:

http://www.localhost:8080 {
  redir / http://localhost:8080{uri} 301


http://www.localhost:8080 {
  redir http://localhost:8080{uri} 301

does not redirect but rewrite instead(!!!). Yes, it displays http://localhost:8080 content under http://www.localhost:8080 which breaks the mental image I built about redir and rewrite.

I’m not trying to nitpick or something. I’m honestly trying to understand Caddy.

Try redir http://localhost:8080{uri}.

If you use redir http://localhost:8080{uri} 301, there are three tokens, so the directive assumes you’re specifying redir from to [code] and omitting code.

Oh, now it makes sense. I aprreciate your responses, Matthew.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.