Questions tagged [x-accel-redirect]

Nginx header to provide access-controlled downloads

Using Nginx X-Accel-Redirect, you can apply permissions to files served directly by Nginx or combine Django and WordPress in the same URL paths. Works similar to Apache mod_xsendfile.

Related Links

55 questions
7
votes
1 answer

Adding custom HTTP headers to nginx X-Accel-Redirect

I am serving restricted downloads in rails using X-Accel-Redirect with nginx. To validate my downloads in client app, i am trying to send the checksum in the non standard HTTP header Content-MD5 to the X-Accel-Redirect request. But this is not…
RameshVel
  • 60,384
  • 28
  • 166
  • 207
6
votes
1 answer

Nginx cuts off static files downloads early

I have a Flask app that redirects requests that should get served static files to NGINX through x-accel-redirect. On occasion, those downloads will get cut off before being finished. For example, through cURL, I'd see: curl…
Eli
  • 31,424
  • 32
  • 127
  • 194
5
votes
1 answer

Nginx: X-Accel-Redirect not working in files with know MIME extension

I am developing a webapp and X-Accel-Redirect header works fine only in files without extension. For some reason, if I add an extension to the file name the X-Accel-Redirect doesn't work. Working example: X-Accel-Redirect:…
robregonm
  • 597
  • 3
  • 12
4
votes
1 answer

How to use Nginx X-Accel with Symfony?

I would want to use Nginx X-Accel with Symfony, for the moment I've this code. $request->headers->set('X-Sendfile-Type', 'X-Accel-Redirect'); $request->headers->set('X-Accel-Mapping', '/var/www/html/files/=/protected-files/'); …
mpiot
  • 1,182
  • 1
  • 12
  • 28
4
votes
2 answers

Unable to get nginx internal redirect to work

I'm using ubuntu 14.04 and running nginx 1.4.6 as reverse proxy server to talk to my django backend which runs on uwsgi. I'm unable to get the internal redirect to work, that is, the request does not reach django at all. Here is my nginx…
Balaji Kutty
  • 41
  • 1
  • 4
3
votes
2 answers

How to serve part of a file with Nginx?

I'm using X-Accel to serve protected content, using X-Accel-Redirect. Is it possible to serve only a part of the file? for example, bytes range 0-x, or first 5 minutes of a video (my final goal) It's important to do that on the server-side, so the…
HTMHell
  • 4,572
  • 4
  • 30
  • 70
3
votes
1 answer

X accel redirect not downloading the file

I'm trying to add authentication to allow only valid users to download static files from nginx. This is my Nginx configuration : location ^~ /download-logs { internal; alias media/logs; } And in Django I've added a route to handle the…
Pavan Skipo
  • 1,607
  • 7
  • 24
3
votes
0 answers

NGINX X-Accel-Redirect doesn't pass Content-Type automatically?

Doesn't (or can't) NGINX's X-Accel-Redirect automatically pass the Content-Type header based on the file? The NGINX part: location /file { rewrite /file/(.+) /file.php?params=$1 last; } location ~ /files { internal; root…
Xairoo
  • 140
  • 7
3
votes
0 answers

Serve static files with X-Accel-Redirect with PHP on nginx

i have some files outside my root directory (/var/www/data) and would like to serve them over an URL e.g. https://example.com/data/?id=123456. I would use for this the X-Accel-Redirect header. My nginx configuration is the following: server { …
Peter W.
  • 31
  • 2
3
votes
0 answers

X-Accel-Redirect for mp4 gives unsupported video type on Internet Explorer Windows 7 only

I'm trying to serve up an mp4 in an html5 video tag using NGINX X-Accel-Redirect header. Here's a sample link (second video works, is served directly): https://www.sonoclipshare.com/testfiles/test.htm Works perfectly for mp4s for Chrome/Safari/FF,…
UltrasoundJelly
  • 1,615
  • 1
  • 14
  • 30
3
votes
1 answer

PHP and Nginx X-Accel-Redirect

I am trying to serve files from a non public directory and not having much fun at all. server { listen 80; listen [::]:80; root /websites/testing.com; index index.php; server_name testing.com; location = /index.php{ include…
Geza Turi
  • 74
  • 3
  • 9
3
votes
1 answer

Nginx X-Accel-Redirect not working with node.js

I'm trying to set up authorized file access on nginx backed by node.js. For some reason all the examples don't work for me. I'm trying to server files from /data/private/files My nginx configuration: ... server { listen 4000; server_name…
ti2m
  • 33
  • 3
3
votes
0 answers

File download with nginx, django

I'm currently writing a small personal-use website served with nginx, utilizing uwsgi, django, and bootstrap. All is going smoothly except for one issue that I cannot figure out. I have download links (buttons) on the site, and when clicked,…
Tony
  • 361
  • 1
  • 4
  • 10
2
votes
0 answers

Django + Nginx - serve private files using X-Accel-Redirect

I'm new to this, but my understanding of how this works is as follows: Request private file from nginx nginx forwards this to django django does its thing, and returns a response containing the X-Accel-Redirect header nginx sees this header, and…
Alex
  • 1,583
  • 20
  • 41
2
votes
0 answers

X-Accel-Redirect not working with SSL

I am using the X-Accel-redirect feature of Nginx for playing videos with a php file named video2.php with the following code: header("X-Accel-Redirect: /Restr/" . $file); (of course, much more executable code before, not necessary by now) I also…
1
2 3 4