Welcome! Log In Create A New Profile

Advanced

difficulty adding headers

ura
June 27, 2014 11:50AM
i need to ensure the Accept-Ranges header is present to serve video files while supporting forward/backwards seeking.
i notice in many tutorials for nginx that this header is shown as being present in server response headers by default, yet not on my present setup.

i have used the following to add the header manually in the relevant places, yet so far have not been successful:

# streamable mp4
location ~* \.(mp4|mp4a)$
#location ~* \.mp4$
#location ^~ /file/download/
{
mp4;
mp4_buffer_size 4M;
mp4_max_buffer_size 20M;
gzip off;
gzip_static off;
limit_rate_after 10m;
limit_rate 1m;
# here you add response header "Content-Disposition"
# with value of "filename=" + name of file (in variable $request_uri),
# so for url example.com/static/audio/blahblah.mp3
# it will be /static/audio/blahblah.mp3
# ----
#set $sent_http_content_disposition filename=$request_uri;
# or
#add_header "content_disposition" "filename=$request_uri";

# here you add header "Accept-Ranges"
#set $sent_http_accept_ranges bytes;
more_set_headers 'Accept-Ranges: bytes';
# add_header "Accept-Ranges" "bytes";
add_header "Cache-Control" "private";
add_header "Pragma" "private";
# tell nginx that final HTTP Status Code should be 206 not 200
return 206;
}

as you can see, i have played with various options, yet none have succeeded. i am not even sure that any of these directives are being called at all. (this is part of a large-ish config file for a social network with many features).

i am aware that nginx ignores add_header directives except for the ones in the final location block for the presently served file.. yet so far this awareness has not yielded a solution.

i am also not seeing a return code of 206 - instead the usual 200 is returned when i access an mp4 file directly via curl.

anyone know what i am missing? thanks
Subject Author Posted

difficulty adding headers

ura June 27, 2014 11:50AM

Re: difficulty adding headers

Maxim Dounin June 27, 2014 12:50PM

Re: difficulty adding headers

ura June 27, 2014 12:54PM

Re: difficulty adding headers

ura June 27, 2014 12:58PM

Re: difficulty adding headers

Maxim Dounin June 27, 2014 02:08PM

Re: difficulty adding headers

ura June 27, 2014 02:23PM

Re: difficulty adding headers

ura June 27, 2014 02:50PM

Re: difficulty adding headers

Maxim Dounin June 27, 2014 03:22PM

Re: difficulty adding headers

ura June 27, 2014 07:26PM

Re: difficulty adding headers

Maxim Dounin June 27, 2014 10:02PM

Re: difficulty adding headers

ura June 28, 2014 10:44AM

Re: difficulty adding headers

ura June 28, 2014 12:17PM

Re: difficulty adding headers

Maxim Dounin June 30, 2014 03:18PM

Re: difficulty adding headers

ura June 30, 2014 04:34PM

Re: difficulty adding headers

Maxim Dounin June 30, 2014 08:34PM

Re: difficulty adding headers

ura July 04, 2014 09:48AM

Re: difficulty adding headers

Maxim Dounin July 04, 2014 12:36PM

Re: difficulty adding headers

Sophie Moussion July 25, 2014 03:40AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 163
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready