redoc
redoc copied to clipboard
Suggestion to allow path delivery
A thought or suggestion that might help others then me..
I have a rather big project using a lot of ingress routing to match different paths to different microservices. I would really love to serve this redoc at /docs, the problem is that react is still fetching the resources from the root, so it can't find them. This can be solved by (not sure all steps are included):
- Update your BrowserRouter by adding a
basename
. Example:<BrowserRouter history={history} basename="/webapp">
. - Specify a homepage on your package.json. Example:
"homepage": "/webapp"
. - Referencing a static file by it's relative path, you should add the subdirectory to that reference. Example:
src="/static/logo/logo.png"
becomessrc="/webapp/static/logo/logo.png"
I'm not sure if it would be possible to actually do this by configuration - haven't tried but it would be really nice. :-)
I'm also looking for this. In the use case I have I'm seeking to host our platform docs at a sub path (not subdomain) like .com/docs
and this is a problem with how all the assets are looking for /static/**
and /**
paths. If we can add an env var to prefix these urls, it would be great!