-
Notifications
You must be signed in to change notification settings - Fork 42
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
Issue with index html resources paths when using a complex path as route prefix #180
Comments
Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests. |
Hello. I spent some time yesterday trying to solve the issue while retaining the behavior wanted by @DavidTanner. Sadly I'm needed elsewhere so I won't have much time to investigate further. |
Please can you fix that? Have the same problem: should be something like that... Sorry, but the code is pretty ambiguous anyway, I would generally go over it... |
How do I solve this problem, I still can't? |
I'm seeing the same problem. Specifying
and hitting localhost:5000/api/v1/help with browser yields a blank page. Inspecting the network activity, the initial GET on http://localhost:5000/api/v1/help works, but the ensuing resource GETs all receive 404s because their paths look like this
Interestingly, adding a trailing "/" (e.g. localhost:5000/api/v1/help/) fixes the problem. |
Correct me if I'm wrong, but it kind of seems like this is a bad setup of the server. Can someone please post a test example? I'm going to try recreating in the project as well. My first thought is that the fastify instance is already using that route prefix, and then you are specifying it again in the swagger config. Again, that is my first thought and I could totally be wrong. |
I figured out the issue, and will create a PR to fix. I need to add a new parameter to specify a prefix that only affects the index.html file. |
Good morning, everyone. Do you have an estimated time to approve this pull request? |
Prerequisites
Fastify version
5.0.0
Plugin version
5.1.0
Node.js version
20.18
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
15.0.1
Description
It's appears #178 is causing an issue when using a complex path in
routePrefix
, ie:The resolved path looks like
/api/v1/api/v1/$docs/static
in that case.See linked repo for MRE.
Link to code that reproduces the bug
https://github.com/jpb06/fastify-swagger-ui-routeprefix-issue-repro
Expected Behavior
index resources to load properly.
The text was updated successfully, but these errors were encountered: