Monviech / os-caddy-plugin

Caddy Plugin with GUI for OPNsense
Other
38 stars 0 forks source link

Add rewrite directive so the internal uri can be modified #55

Closed Monviech closed 8 months ago

Monviech commented 8 months ago

I need this in a few cases, so I have to add it.

https://caddyserver.com/docs/caddyfile/directives/rewrite

A handle with a rewrite will look like this:

# Reverse Proxy Domain: "9ec53848-971d-427e-a81c-5107a4094e6d"
example.com:7861 {
        handle /test {
                rewrite * /test/location
                reverse_proxy 172.16.0.173:7861 {
                }
        }

        handle {
                rewrite * /different/location
                reverse_proxy 172.16.0.173:7861 {
                }
        }
}

Since I will add the rewrites into the handles, after they have matched a handle path, I can leave the rewrite always on "*" and then change the location afterwards.

That makes it easy to implement since its just a new field and a small change in the Caddyfile template.

Monviech commented 8 months ago

Hmm probably not... there's not a lot of benefit in it for me. Caddy doesn't have the same problems as nginx does in this regard, so it's kinda useless to implement to fake redirections and stuff. Closing this without implementing it.