-
Notifications
You must be signed in to change notification settings - Fork 420
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
Wrong host in Swagger JSON in v9.0.0 #492
Comments
Can confirm this issue is happening to us as well |
Hi! As a temporary workaround, setting |
confirm same error using @nhhagen fix works for now |
Wouldn't it be much better to simply use a relative path and ignore the host? There are so many scenarios I can think of right now which would make it much more necessary to not deal with the Hapi server configuration but just use the host the documentation is currently viewed with, e.g. a proxied or containerized environment. |
Happening to me as well. I would prefer not to use the ugly hack. I'm using hapi-require-https for http redirect and it seems to do server.ext. I'm afraid the hack would overwrite what hapi-require-https is doing. Or maybe I just don't understand how it works... |
Any solution for this? |
@nhhagen thanks. it works! hope this was built in such that if hapi's host = 0.0.0.0, hapi-swagger uses the host's current IP directly... |
I'm also facing this problem with hapi 17.5.0 and hapi-swagger 9.1.1 |
I also, am experiencing the same thing from my end. |
The address should definitely not come from the server, it should either be relative or from the browser. In the case of the server residing behind a load balancer (I am experiencing this issue), if the IP Address of the server is used then the client will never be able to reach the server if the servers behind the firewall are not directly exposed to the browser. |
Any update on this issue? |
Closed with the release of v9.1.2 |
Context
What are you trying to achieve or the steps to reproduce ?
E.g accessing http://my-hostname:8443/documentation allows me to run requests, accessing http://localhost:8443/documentation does not allow me to requests. Using curl I can run my requests.
It turns out the swagger JSON is not generated with the host from the request header like it used to.
In
./lib/builder.js
L150 the host is now read from the server configuration and not the request host header. This causes the swagger ui only to be useable from the address that is selected by hapi as the server address. This was changed between v7.x and v9.0.0https://github.com/glennjones/hapi-swagger/blob/v9.0.0/lib/builder.js#L150
https://github.com/glennjones/hapi-swagger/blob/v7.9.1/lib/builder.js#L159
v7.9.1...v9.0.0#diff-dde50c51d91de11d407f53423f3baeecL159
As a workaround one can do (but is an ugly hack):
The text was updated successfully, but these errors were encountered: