1 web application with HTTP Server (Flask, Gitlab, …), port 80 (on docker)
1 Caddy for proxy, port 80 and 443 (on docker)
New user cannot post with more than 4 links, so add http or https before // (:()
Application don’t have parameter like base_url, so each page and ressources point on address (//myapp/index.html, //myapp/css/mycss.css, //myapp/js/myjs.js, …)
Caddy proxy request to application with this configuration :
If i go to //caddy/app, proxy done and get //myapp/index.html but all ressources is missed (they try to //caddy/css/mycss.css and not //caddy/app/css/mycss.css
How can do this simply ? I try rewrite and filter with no success (perhaps i don’t use this directives correctly).
Regarding the links - code-formatted links aren’t counted (because they aren’t hyperlinked), so you can put your examples in code blocks.
What’s happening is that you’re proxying everything after /app directly to the webroot of your destination. You want to ensure that /app remains appended to the destination, so try this instead:
You generally can’t put an app in a subfolder unless it expects to be inside a subfolder. The app itself is generating those links - you need some way to tell the app to generate the correct ones.
This almost always involves sending the full path including subfolder upstream. Having the URI aligned between reverse proxy and upstream server is a much simpler configuration. By proxying from a subfolder to the web root upstream, you’re stripping the subfolder prefix - the client sees /app1/foo/bar but the app itself thinks someone’s requesting /foo/bar.
Otherwise, if you know the format that those links take in HTML, you could try using http.filter to have Caddy rewrite them before sending them back to the client.