Rewrite local service's static url to subpath

I have a local service. I want use Caddy to route to it by a path. Here is my config


placeholder.suffix {
    tls ./fullchain.pem ./privkey.pem
    handle_path /mypath* {
        rewrite * /{uri}
        reverse_proxy localhost:3000 {
            header_up X-Real-IP {remote}
            header_up X-Forwarded-Proto {scheme}
        }
    }
}

This works well, but this local service use some static url to obtain assets. For example, it will request file from placeholder.suffix/static/some.js. Then, this fails. Is there a way to rewrite this request to placeholder.suffix/mypath/static/some.js, therefore it could correctly goto local service? Thanks!

Check out this article:

Either the app has to support being served out of a subfolder (WordPress does, for example) or you have to do some intense response manipulation.

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