Skip to content

Commit c1812d5

Browse files
ansdmergify[bot]
authored andcommitted
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. (cherry picked from commit 11e56bd)
1 parent 1d07145 commit c1812d5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

deps/rabbit/src/rabbit_reader.erl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,6 +1123,9 @@ handle_input(handshake, <<Other:8/binary, _/binary>>, #v1{sock = Sock}) ->
11231123
<<16#16, 16#03, _Ver2, _Len1, _Len2, 16#01, _, _>> ->
11241124
%% Looks like a TLS client hello.
11251125
detected_unexpected_tls_header;
1126+
<<"GET ", _URL/binary>> ->
1127+
%% Looks like an HTTP request.
1128+
detected_unexpected_http_header;
11261129
_ ->
11271130
bad_header
11281131
end,

0 commit comments

Comments
 (0)