single-page-applicationcaddycaddyfile

How to make Caddy server keep the same subpath even if web app redirects to root path?


I have basic setup:

A static website is hosted under /subpath/spa, but it keeps navigating to a /page without subpath part. How to keep teh web app it served under /subpath/spa and /subpath/page in any condition?

Some additional details that do not affect the main question: I actually prefer Caddy using this project and SPA web app is X-UI dashboard, all under Docker. But that does not really affect the question, I can remap your configs to Docker labels.


Solution

  • I decided, that, since:

    - it is easier to switch my subdomain list from domain registar to any DNS hosting (to get more subdomains count) and add subdomain as A record for each web app I need.

    That's it, each frontend web app has hostname-webappname.example.tld subdomain. It is the easiest way I discovered myself.