Skip to content
This repository was archived by the owner on Aug 13, 2025. It is now read-only.

Conversation

@kouk
Copy link

@kouk kouk commented Aug 1, 2025

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-path option 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 base config to web_app/vite.config.js to either ./ or to /iopaint but had no luck. There was an error in the JS console about Cannot 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:

:9090
handle_path /iopaint/* {
        reverse_proxy localhost:8080
}

Then run IOPaint:

iopaint start --root-path /iopaint

Then visit http://127.0.0.1:9090/iopaint/docs (it should work)

@kouk
Copy link
Author

kouk commented Aug 1, 2025

@Sanster would be interested in your thoughts on this, including on how I might overcome the "Important Limitation" described above.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant