-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Simplify HTTP configuration #3840
Conversation
while I never had bigger problems with it, these "duplicate" settings were indeed a little confusing and I like this change 👍 |
44c6978
to
28aa7f3
Compare
28aa7f3
to
1c6a4ae
Compare
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.
Overall this looks much better than the situation before!
I have a few minor nitpicks, regarding methods and constants and only one issue regarding IPv6 wildcard address handling.
That's probably more of an edge case, but at least we should return a valid IP address in that case.
UPGRADING.rst
Outdated
+---------------------------------+----------------------------------+--------------------+ | ||
| ``web_max_initial_line_length`` | ``http_max_initial_line_length`` | ``4096`` | | ||
+---------------------------------+----------------------------------+--------------------+ | ||
| ``web_thread_pool_size`` | ``http_thread_pool_size`` | ``false`` | |
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.
Should be 16
I guess
public HostAndPort getHttpBindAddress() { | ||
return httpBindAddress | ||
.requireBracketsForIPv6() | ||
.withDefaultPort(9000); |
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.
This should also use the constant GRAYLOG_DEFAULT_PORT
return getUriScheme(isHttpEnableTls()); | ||
} | ||
|
||
public String getUriScheme(boolean enableTls) { |
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.
I think this is only used once in the method above and could be inlined.
} | ||
|
||
@VisibleForTesting | ||
URI getDefaultHttpUri(String path) { |
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.
This can be private as it is not directly used in tests (only via its two private usages)
null, | ||
bindAddress.getHost(), | ||
bindAddress.getPort(), | ||
"/", | ||
null, | ||
null | ||
); | ||
|
||
apiHttpServer = setUp("rest", |
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.
The prefix is now unused and always "rest"
so I think we can rid of the parameter.
final HostAndPort bindAddress = getHttpBindAddress(); | ||
|
||
final URI publishUri; | ||
if (WILDCARD_IP_ADDRESS.equals(bindAddress.getHost())) { |
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.
This currently does not take the IPv6 wildcard address into account and will publish [::]
as the URI, which is invalid.
I think that adding a check against [::]
and extending Tools.guessPrimaryNetworkAddress()
to also look for IPv6 addresses, would be the best option here.
final URI defaultHttpUri = getDefaultHttpUri(); | ||
LOG.debug("No \"http_publish_uri\" set. Using default <{}>.", defaultHttpUri); | ||
return defaultHttpUri; | ||
} else if (WILDCARD_IP_ADDRESS.equals(httpPublishUri.getHost())) { |
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.
This does not take the IPv6 wildcard address into account: [::]
. See below for another instance of that.
[ci skip]
[ci skip]
d4bb107
to
80f50c3
Compare
With the latest changes I get the error message:
When using |
80f50c3
to
9500a81
Compare
@kroepke I guess I'm not convinced that this approach (that worked reasonably well for IPv4) is suitable for IPv6. 🤔 |
Nevermind, this was due to automatically binding to a different interface. Works as expected. |
Looks good, thanks for the rebase and implementing this! |
The old options got removed and the user has to change her config to the new one. Refs #3840
* Include query and hash params in qualified URLs Some URLs require some search query parameters to be set, and this stopped working since #3840. Fixes #4290 * Use string templates instead of concatenating * Add Routes tests - Test routes with prefix - Test routes with no prefix - Ensure search query parameters are not removed from routes
Motivation and Context
Users regularly have problems finding the correct settings for the Graylog REST API and Graylog web interface listeners in their environments.
This change set tries to simplify the network settings for the Graylog HTTP interfaces (Graylog REST API and web interface).
The two separate network listeners for the Graylog REST API and the Graylog web interface have been merged, vastly reducing the necessary configuration settings.
While the the Graylog REST API and the Graylog web interface could be configured separately via the
rest_listen_uri
andweb_listen_uri
settings in the past, they now run on the same network listener which can be configured viahttp_bind_address
.The context path for the Graylog REST API is now hard-coded to
/api
.Types of changes
Checklist: