Skip to content

Commit 42d1393

Browse files
ansdikavgo
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.
1 parent b3d82dc commit 42d1393

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
@@ -1140,6 +1140,9 @@ handle_input(handshake, <<Other:8/binary, _/binary>>, #v1{sock = Sock}) ->
11401140
<<16#16, 16#03, _Ver2, _Len1, _Len2, 16#01, _, _>> ->
11411141
%% Looks like a TLS client hello.
11421142
detected_unexpected_tls_header;
1143+
<<"GET ", _URL/binary>> ->
1144+
%% Looks like an HTTP request.
1145+
detected_unexpected_http_header;
11431146
_ ->
11441147
bad_header
11451148
end,

0 commit comments

Comments
 (0)