redoc icon indicating copy to clipboard operation
redoc copied to clipboard

Suggestion to allow path delivery

Open malnor opened this issue 3 years ago • 1 comments

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):

  1. Update your BrowserRouter by adding a basename. Example: <BrowserRouter history={history} basename="/webapp">.
  2. Specify a homepage on your package.json. Example: "homepage": "/webapp".
  3. Referencing a static file by it's relative path, you should add the subdirectory to that reference. Example: src="/static/logo/logo.png" becomes src="/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. :-)

malnor avatar Apr 21 '21 11:04 malnor

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!

ziazon avatar May 08 '23 12:05 ziazon