Skip to content

Issue When Setting basename on RR Config #72

@s-cochrane

Description

@s-cochrane

We have our RR server instance behind a reverse proxy and use the basename property in react-router.config.ts as well as the base property in vite.config.ts to make this work. This moves the RR base path as well as the base for the static assets. When following the docs for setting this same property with react-router-hono-server, the route moves to the new path set by 'basename', but all the static assets continue to be served at the root path. This breaks the app when placed behind the reverse proxy as the asset requests aren't routed properly. Is there a way to get all assets as well as the RR app routes served based on the basename?

I cloned the repo and ran the custom-mount example app while changing the basename config to /v2. This resulted in the /v2 path resolving correctly for RR, but the first asset request was for http://localhost:5173/app/styles/tailwind.css, and all the other assets follow the same pattern. Setting the base config in vite.config.ts to match results in the request path from the client being correct, but the assets aren't resolved and result in a 404, http://localhost:5173/v2/app/styles/tailwind.css.

Running a production build with the basename change only also results in the static assets still being requested to the root, http://127.0.0.1:3000/assets/tailwind-p7bQns9R.css.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghelp wantedExtra attention is neededinvestigatingI'm looking at this!

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions