React UI that authenticates with Okta and talks over a websocket to a Java backend

handle_path also did not work. i see a bunch of .js and .css files, but the page itself is blank. I will also put it in the /ui folder in the build, no problem doing that

never mind that is not so simple, will have to think about that :slight_smile:

See this quote (plus read the linked wiki).

Make sure to check what configuration options are at your disposal for the build such that the base path is added.

I would strongly recommend that you try reading more of the documentation and linked threads we give you before coming back with more questions. It’ll help you learn faster and avoid having us repeat things we’ve already wrote, saving more of our time.

This is working for me, might be what you need? I see you did it earlier, but stated it wasn’t working.

I have a Gatsby React project that I used Caddy on recently via the official image on DockerHub and a volume mount to serve it. Did a quick test to emulate the subpath you are wanting to do and got the following working:

redir /ui /ui/
handle_path /ui/* {
    root * /app/build
    file_server
}

# If you get an error, you might get a blank page in the browser, but curl will show 404, this will just help when testing in the browser.
handle_errors {
	respond {http.error.status_code}
}

Side note, with Gatsby it’s expected that the build output defaults to the domain root. To serve from a subpath requires adding config and build flag to use a path prefix while building such as /ui. On disk no such directory needs to exist and handle_path as explained will drop that expectation. Otherwise it’s router logic is resetting the location bar to seem like it’s loading from the root domain (or appear like it redirected).

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