We have noticed that when using nginx internal 301 and 302 handling, nginx will serve a small document body with the appropriate Location: ... header.
Something along the lines of (in html): 301 redirect - nginx.
As appropriate in the above behaviour, a content-type text/html and content-length header is also sent.
We do a lot of 302 and some 301 redirects, the above behaviour is wasted bandwidth in our opinion.
Any way to disable this behaviour?
One idea that crossed our mind was to set error_page 301 302 to an empty text file. We have not tested this yet, but I am assuming even with the above, the content-type and content-length (0) headers will be sent.
So, is there a clean way to send a "body-less" 301/302 redirect with nginx?