This repository was archived by the owner on Aug 13, 2025. It is now read-only.
Make root path configurable #665
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
Sometimes we might want to run IOPaint behind a reverse proxy that strip a prefix from the URL path. This might be an nginx, Traefik or caddy service, or some managed hosting service.
I.e. https://myhost.com/iopaint
This breaks the app however because it assumes that everything is located at the root path from the browser's perspective.
Solution
add an
--root-pathoption so that you can configure FastAPI to generate URLs that point to the prefix instead of at the root.Important limitation
The static assets in the UI are still referencing the root path. This means functionally if you change the root path the UI doesn't work (only the API browser). I tried to add the
baseconfig toweb_app/vite.config.jsto either./or to/iopaintbut had no luck. There was an error in the JS console aboutCannot read properties of undefined (reading 'split')with regards the model name. Unfortunately I'm not familiar with Vite to be able to fix it but if I can get any pointers I will spend some more time troubleshooting this..How to test
Use caddy with this
Caddyfile:Then run IOPaint:
Then visit http://127.0.0.1:9090/iopaint/docs (it should work)