Skip to content
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

Different HTTP response code for HEAD and GET requests #713

Open
rafajot1 opened this issue Jul 4, 2024 · 3 comments
Open

Different HTTP response code for HEAD and GET requests #713

rafajot1 opened this issue Jul 4, 2024 · 3 comments

Comments

@rafajot1
Copy link

rafajot1 commented Jul 4, 2024

Description

This is a follow-up to Azure support request ID | 2406240050002544

Actual Behavior

http status code for the same HEAD and GET http requests is different (404 NOT FOUND for HEAD and 200 OK for GET).

This seems to be a protocol violation: https://www.rfc-editor.org/rfc/rfc9110.html#name-head

Expected Behavior

Azure service bus should return the same HTTP response codes for HEAD and GET requests.

@EldertGrootenboer
Copy link
Contributor

@rafajot1 Can you please provide more information on the scenario, and the URL(s) where this behavior is noticed?

@rafajot1
Copy link
Author

rafajot1 commented Jul 5, 2024

When it comes to examples I think the reported behaviour is true for most of cases but to be specific if I create SB with default settings and send request to the root URL it's already reproducible, for example:

$ curl -v https://rafal-testsb.servicebus.windows.net 2>&1|grep HTTP/1.1
> GET / HTTP/1.1
< HTTP/1.1 200 OK

$ curl -v -I https://rafal-testsb.servicebus.windows.net 2>&1|grep HTTP/1.1
> HEAD / HTTP/1.1
< HTTP/1.1 500 Internal Server Error
HTTP/1.1 500 Internal Server Error

I noticed that sometimes HEAD request to the root URL returns 404 response instead of 500. I don't really know when it's 404 and when it's 500. Anyway HEAD responses are different than GET responses (from my experience always 200 OK).
I guess there may be other scenarios for example on the entity level instead of root URL where http response codes might be different than in the example above but still not the same for HEAD and GET.

There might be various reasons why having consistent responses for HEAD and GET can be desirable. Examples that come to my mind are:

  • loadbalancers that often use HEAD to test backend health
  • manual inspection done with curl -I where HEAD response != 200 may lead to confusion
  • being aligned with the HTTP protocol

@EldertGrootenboer
Copy link
Contributor

Thank you for your feedback. We have opened an investigation task for this in our backlog, and will update this issue when we have more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants