-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Heartbeat] HTTP 302 redirect behavior #10823
Comments
Pinging @elastic/uptime |
@andrewkroh I agree that heartbeat should not follow redirects. Thanks for finding this! |
When this will be addressed, could it be made configurable ? |
Same thing over here. We have a https://link.to/12345 which redirects to a https://verylongdomainwithmanychars.com/share/12345. Wanted to check the redirector if there is a 302, and the SSL certificate status. |
I'm using Heartbeat 7.2.0 and the behaviour when trying to check for 302 response is that not only it follows the redirect automatically, but apparently it does not follow locations from different domains, for example: type: http the response to http://domain.com/redirect is a 302 with Location: https://otherdomain.com/destination Thus, the monitor always receive a 503 error, as it only consider the location path and tries to reach domain.com/destination which does not exists. |
Thanks for the report @fabionitto that's definitely a bug, we'll try and take a look at it relatively soon. |
Also, I managed to check the code and found the max_redirects config parameter, which defines how many redirects Heartbeat will follow. You can set it with 0 redirects and then it will receive the 302 HTTP code as expected. If this config is fully functional I think it could be added to documentation, which apparently is missing. type: http |
Thanks for the patch @fabionitto . This is actually a harder problem to solve than it would appear. The main reason being the presence of One possible solution would be to only allow redirects with I think the stronger approach would be to spawn an additional check for each redirect, yielding an additional document. This is actually easy enough in heartbeat since we use continuation passing style internally, however, from a UX/UI side this gets tricky to represent. However, it may be worth tackling. @roncohen @katrin-freihofner I'd be curious to hear your thoughts on ^^ |
🤔I agree, it should not automatically follow redirects. I think I would expect to get a 3XX redirect code. Additionally, it would be super nice to get a |
Taking this all together I do think it makes sense to:
While there are valid use cases for redirects, I don't think we can handle them well now. In the future this might be better handled by an enhanced transaction, or even synthetics mode where we can check a transaction across multiple URLs, but today this is just awkward. |
I'm seeing this issue as well with Heartbeat v7.3.0 |
I've created a tracking issue with a proposed fix here: #13146 . Would appreciate input from those in this thread on the approach! |
Fixed via #14125 , release targeting 7.6 |
I'm monitoring an HTTP endpoint that returns a 302 redirect to send clients to the HTTPS site. Heartbeat is making 10 requests for each check instead of just one. It's a lot more HTTP requests than I expected to see.
Ideally for this use case Heartbeat would not follow redirects. I didn't find anything in the documentation that describes Heartbeat's redirect following behavior. But the Go HTTP client's default behavior is:
The DNS response returns a single private IP address.
This screenshot shows two consecutive checks from Heartbeat as captured by Packetbeat. Each row represents one HTTP requests made by Heartbeat.
The text was updated successfully, but these errors were encountered: