Fwd: RTSP request response

Maxim Dounin mdounin at mdounin.ru
Wed Mar 11 12:00:58 UTC 2020


Hello!

On Wed, Mar 11, 2020 at 01:06:06AM +0300, Valentin V. Bartenev wrote:

> On Tuesday, 10 March 2020 18:43:56 MSK Seena Fallah wrote:
> > Hi all.
> > When we send RTSP request to NGINX, NGINX will return 400 bad request
> > without headers and when we have loadbalancers like HAProxy in front of
> > NGINX because of no headers, HAProxy figured out that the response from
> > NGINX is invalid and return 502!
> > Won't you want to send headers with the response for these types of
> > requests?
> > 
> 
> What nginx version do you use?
> 
> If nginx fails to parse a request line, it returns a valid HTTP/1.0 response
> (with headers).
> 
> But before nginx 1.5.5 (which was released about 7 years ago) it used HTTP/0.9
> protocol to respond in this case.

The RTSP protocol uses requests like (quote from 
https://en.wikipedia.org/wiki/Real_Time_Streaming_Protocol):

OPTIONS rtsp://example.com/media.mp4 RTSP/1.0
CSeq: 1
Require: implicit-play
Proxy-Require: gzipped-messages

This will be interpreted as HTTP/0.9 request with method "OPTIONS" 
and URI "rtsp://example.com/media.mp4 RTSP/1.0", and will trigger 
400 due to invalid method for HTTP/0.9.

Removing support for spaces in URI (as introduced in 31e9677b15a1, 
0.8.41) should make the response to be interpreted as a garbage 
instead, leading to a HTTP/1.0 response.  Since support for spaces 
in URI is something known to cause other issues as well (see 
https://trac.nginx.org/nginx/ticket/196), this might be something 
are willing to do.

Note though that it is generally a bad idea to assume that a RTSP 
frequest will trigger a meaningful response from an HTTP server.

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx-devel mailing list