Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hosting swagger /docs/ under reverse proxy URL prefix results in schema not found #234

Closed
bduncanj opened this issue Nov 14, 2024 · 4 comments · Fixed by #235
Closed

Hosting swagger /docs/ under reverse proxy URL prefix results in schema not found #234

bduncanj opened this issue Nov 14, 2024 · 4 comments · Fixed by #235

Comments

@bduncanj
Copy link

As the title suggests, hosting the Oxygen generated endpoint under a reverse proxy (say, under the URL prefix of /api/) results in an error (schema not found) when accessing the Swagger API/api/docs on the server.

The path /api/schema/ is valid but the issue is that the /docs page injects the schema using location.origin.

Setting the external_url argument of serve() doesn't help - this is not passed into the function (swaggerhtml in autodoc.jl).

Is there an existing method to support hosting the Oxygen endpoint under a reverse proxy with a URI prefix? If not, it seems we could use the external_url in swaggerhtml() when building the path to include the schema.

@ndortega
Copy link
Member

Hi @bduncanj,

Thanks for opening this issue - I don't see why we shouldn't be able to set the host prefix to the external_url (if set)

@ndortega
Copy link
Member

@bduncanj

Does the /docs/redoc endpoint work behind the reverse proxy? The redoc docs uses a relative url to point to the schema - if this works then we can take a similar approach to the default swagger docs

@ndortega ndortega linked a pull request Nov 27, 2024 that will close this issue
@bduncanj
Copy link
Author

@ndortega sorry for the delay in getting back to you on this one, but thank you for the quick response! It sounds like you've found the cause and fixed this. From my memory the same happened on the /docs/redoc URL also for the same reason.

@ndortega
Copy link
Member

@bduncanj,
No worries, this time of the year is super busy for everyone. After I didn't hear a response, I just assumed the relative path for the docs were working.

As part of a recent patch I only removed the window.origin part - so it very well could still be failing. If the latest version still isn't working, let me know and I'll reopen this issue and find a way to insert the external_url

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants