Detect misconfigured HTTP clients
It also happens from time to time that HTTP clients use the wrong port 5672. Like for TLS clients connecting to 5672, RabbitMQ now prints a more descriptive log message. For example ``` curl http://localhost:5672 ``` will log ``` [info] <0.946.0> accepting AMQP connection [::1]:57736 -> [::1]:5672 [error] <0.946.0> closing AMQP connection <0.946.0> ([::1]:57736 -> [::1]:5672, duration: '1ms'): [error] <0.946.0> {detected_unexpected_http_header,<<"GET / HT">>} ``` We only check here for GET and not for all other HTTP methods, since that's the most common case.
This commit is contained in:
parent
7ed3a0b0d8
commit
11e56bdd2d
|
@ -1123,6 +1123,9 @@ handle_input(handshake, <<Other:8/binary, _/binary>>, #v1{sock = Sock}) ->
|
|||
<<16#16, 16#03, _Ver2, _Len1, _Len2, 16#01, _, _>> ->
|
||||
%% Looks like a TLS client hello.
|
||||
detected_unexpected_tls_header;
|
||||
<<"GET ", _URL/binary>> ->
|
||||
%% Looks like an HTTP request.
|
||||
detected_unexpected_http_header;
|
||||
_ ->
|
||||
bad_header
|
||||
end,
|
||||
|
|
Loading…
Reference in New Issue