-
Notifications
You must be signed in to change notification settings - Fork 126
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
adding method to return the hostname where httpbin is running #66
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, I think this is a nice idea, thanks! I left a couple of small comments below, let me know what you think.
I’m on vacation this week (reviewing from phone), so probably won’t get a chance to try this out till Sunday. Thanks for your patience!
Hey @uromahn, I'm sorry for the long delay in getting back to this. Would you mind letting me know what your use case is for this feature? Having thought about it for a while, I no longer think this is a good feature to add. The rest of go-httpbin's functionality is about the incoming HTTP request, the client making the request, or exercising interesting characteristics in HTTP responses. This would be the first feature to intentionally[1] reveal something about the underlying infrastructure, and I don't want to add that unless there's a good reason to do so, and I can't think of one myself! [1] I say "intentionally" here because some infra details are likely leaked in response headers added by the platform where a go-httpbin instance is hosted, but that's relatively unavoidable. |
Closing for now, will reopen if there's a compelling use case for this functionality! |
I understand the argument that this would be the first infrastructure related information and maybe it fits not perfectly into httpbin. My experience: I was debugging around on a haproxy and worked on the load balancing setup in a containerized environment. A workaround was to add the requested server as information to the header, so that httpbin returns this value in its response back to my browser. But it would be much easier if httpbin could just return this. (Or something else where I can distinguish between 2 httpbin instances.) So I would like to see this feature. |
Ah, that is an interesting use case! If we were to enable this functionality, I'd want to make it opt-in only to avoid unexpectedly revealing more information about existing go-httpbin instances than we were previously revealing. Would that work for your use case? |
Yeah, that's probably something that we don't want to expose by default. |
This adds a new /hostname endpoint as originally proposed in #66. In this implementation, it exposes a dummy hostname by default, and only exposes the real hostname (via `os.Hostname()`) if the `-expose-real-hostname` flag is given on the command line.
This adds a new /hostname endpoint as originally proposed in #66. In this implementation, it exposes a dummy hostname by default, and only exposes the real hostname (via `os.Hostname()`) if the `-expose-real-hostname` flag is given on the command line.
This adds a new /hostname endpoint as originally proposed in #66. In this implementation, it exposes a dummy hostname by default, and only exposes the real hostname (via `os.Hostname()`) if the `-expose-real-hostname` flag is given on the command line.
This adds a new /hostname endpoint as originally proposed in #66. In this implementation, it exposes a dummy hostname by default, and only exposes the real hostname (via `os.Hostname()`) if the `-use-real-hostname` flag is given on the command line.
This adds a new /hostname endpoint as originally proposed in #66. In this implementation, it exposes a dummy hostname by default, and only exposes the real hostname (via `os.Hostname()`) if the `-use-real-hostname` flag is given on the command line.
FYI for anyone watching this pull request: this was added in #81, but disabled by default. |
I wanted a method that identifies the host httpbin is running on and returns the hostname.