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
2
votes
0 answers

XSendFile: Varnish + nginx reverse proxy + apache

I have installed XSendFile on my server (using the apxs -cia mod_xsendfile.c) in vhosts I'v turned it on, and gave the directory of my files to it now the problem is, ERR_INVALID_RESPONSE and this is the code: header("Content-Type:…
2
votes
1 answer

nginx + unicorn + rails + streaming

I am trying to stream audio using using nginx, unicorn, and rails 4. I am using following these two links : one and two and this is what I have got so far --> nginx.conf location /protected/ { internal; alias /$1/; …
smanvi12
  • 531
  • 6
  • 20
2
votes
1 answer

X-Accel-Redirect never set in rails 4 app when calling send_file

I'm working with a rails 4 app served with Puma and Nginx. In trying to directly serve certain files I've set config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" in config/environments/production.rb, and I can confirm the setting is…
Craig
  • 389
  • 3
  • 15
2
votes
2 answers

Serving protected files with Symfony2 and Nginx X-accel-redirect

My config is php-fpm 5.4 with nginx. I need to serve some protected files. So I check with Symfony if the user has the correct rights and then I would like nginx to serve the file (a swf) using the X-accel-redirect header. Controller in…
JuCachalot
  • 990
  • 4
  • 13
  • 24
2
votes
1 answer

Nginx pass upstream headers to the remote request

This question is similar to this one but doing x-accel-redirect on aws s3 resource. The former tried to set the upstream headers to the local request. This works fine. But now i have moved my contents to the amazon s3 and i wanted to implement the…
RameshVel
  • 60,384
  • 28
  • 166
  • 207
1
vote
1 answer

Wrong internal redirect alias for X-Accel-Redirect

Nginx internal redirect file search in wrong path. I'm using nginx and laravel(PHP) and want to doing secure online storage.if user exist and has permission, user can download file. I'm use 'X-Accel-Redirect' for this action. //it works with…
Umut Akkaya
  • 63
  • 1
  • 2
  • 4
1
vote
1 answer

X-Accel-Redirect feature does not work for external connections (inside docker network)

I'm trying to allow container with django to manage access to media files served from another container with nginx. Because of that despite of nginx documentation, I've removed the internal line from the location config: server { server_name…
Vassily
  • 3,957
  • 4
  • 22
  • 52
1
vote
1 answer

Nginx "X-Accel-Redirect" serves pdf at plaintext

I'm having a problem getting my pdf file to display on the browser using X-Accel-Redirect. Linking the file URL directly from Nginx public location works out fine. However, restricting access to the location by adding in "internal" and calling…
1
vote
0 answers

X-Accel-Redirect + php not working

Alright guys, I recently started messing with nginx and I need some help. I spent an entire day trying to figure this and I am simply done with it. After I set the header in php for x-accel-redirect to work, I get an empty response. I am trying to…
Miguel
  • 772
  • 1
  • 7
  • 24
1
vote
0 answers

Nginx: Is post_action skipped when Rails returns a X-Accel-Redirect header is used?

The post_action in the config for my Nginx 1.4.2 instance is not firing (or does not appear to be). I'm wondering if it is because Rails is returning a X-Accel-Redirect header. The ultimate goal is track when downloads hosted on S3 have completed. …
onedanshow
  • 201
  • 3
  • 5
1
vote
0 answers

“X-Accel-Mapping header missing” in Nginx error log

In Rails in my controller I set response header explicitly : response.headers['X-Accel-Redirect'] = "some_url" Nginx Config location ~* ^/some_url/(.*){ set $s3_bucket '$arg_bucket_name'; set…
Groovy
  • 57
  • 1
  • 10
1
vote
1 answer

Different behavour of "location" and "proxy_pass" on nginx x-accel-redirect

I have my nginx conf like : location ^~ /mount_points/mount_point1 { internal; alias /repos/mount_point_one; } location ^~ /to_proxy { internal; proxy_pass http://myproxy:5000; } When I request for…
chenxin
  • 183
  • 1
  • 8
1
vote
1 answer

Nginx x-accel redirect named location uri

I was using nginx x-accel-redirect as an authentication frontend for an external resource. In my python code I would do the following: /getresource/ def view(self, req, resp): name = get_name(req.user.id) # authenticates request. …
acid_crucifix
  • 333
  • 2
  • 10
1
vote
2 answers

nginx proxy_pass with https protocol leads to "invalid URL prefix" error

I'm running a php app behind nginx on dokku. I got a location with a proxy_pass directive defined like this: location ~* ^/cdn/(.*?)/(.*) { resolver 8.8.8.8; proxy_set_header HOST $1; proxy_pass https://$1/$2?$args; } I'd like to use this…
rokfor
  • 107
  • 11
1
vote
1 answer

X-Accel-Redirect works from outside, but not from inside

So here's my thing. Got a php app running on nginx/dokku. I have a location which is redirecting image assets. Say: https://test.rokfor.ch/cdn/dummyimage.com/600x400/000/fff Results in a image, shown in the Browser. Calling the same resource within…
rokfor
  • 107
  • 11