Caddy 0.9 Does not allow cookie path/domain rewrite

Caddyfile

mh.pablososa.net {
        proxy / localhost:8080
        rewrite {
                to /internal/{uri}
        }
}

The problem is that I the upstream server sets the cookie to “/internal” path, whereas the downstream client is accessing “/”.

With apache I can use something like ProxyPassReverseCookiePath to solve that. Is it possible to do the same in caddy too?

Well, I’ve never even heard of ProxyPassReverseCookiePath before. :confused:

You can try without /internal in your proxy directive but I am not sure if that will work…

Java ee servers allow deployment of multiple web applications in the same port, but only one can be deployed to root “/”. Then the others have a different “context”. In my example, this is “/internal”. So if I access my java ee server I have to go through “/internal/something…”. But when I configure caddy I put that “context” inside a virtual server, so now I can serve through caddy at root path “/” but redirect to the “/internal” to the upstream server. The problem is that the server isolates contexts sessions and uses cookies for that, in this case, setting a cookie under the “/internal” path. So, you will have a huge market of users who will use caddy if cookie path/domain can be rewritten just like URLs to the upstream server.

I don’t have the time to implement this right now, but perhaps somebody else will.

I see you’ve found a work-around to your issue so I’m just linking to it from here in case others have the same question in the meantime!

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