August 25, 2010 02:35AM
Hello,

I am trying to use the X-Accel-Redirect header feature of Dokuwiki. However, when attempting to access images, for example, I receive an image of zero size which the browsers displays as a URL. I believe my nginx configuration is to blame.

Nginx config:

server {

listen 80;

server_name dev;

root /var/www/public_html/dev/public;
index index.php;
autoindex on;

location ~ \.php$ {
include /usr/local/etc/nginx/fastcgi.conf;
fastcgi_pass unix:/tmp/php-fpm.sock;
fastcgi_index index.php;
fastcgi_ignore_headers X-Accel-Redirect;
fastcgi_pass_header X-Accel-Redirect;
}

location ^~ /doku/data {
internal;
alias /wiki/data;
}

}


When I attempt to access http://dev/doku/lib/exe/fetch.php?cache=&media=image.jpg (on filesystems as /var/www/public_html/dev/public/doku/data/media/image.jpg) the browser displays the following text with an image mimetype:

http://dev/doku/lib/exe/fetch.php?cache=&media=image.jpg


The headers received are:

Server: nginx
Date: Wed, 25 Aug 2010 06:06:42 GMT
Content-Type: image/jpeg
Expires: Thu, 26 Aug 2010 06:06:42 GMT
Cache-Control: public, proxy-revalidate, no-transform, max-age=86400
Pragma: public
Last-Modified: Mon, 23 Aug 2010 17:01:22 GMT
Content-Disposition: inline; filename="image.jpg";
X-Accel-Redirect: /var/www/public_html/dev/public/doku/data/media/image.jpg

200 OK

In the access log the request is shown as:
"GET /doku/lib/exe/fetch.php?cache=&media=image.jpg HTTP/1.1" 499 0 "http://dev/doku/lib/exe/detail.php?id=start&media=image.jpg"
"GET /doku/lib/exe/fetch.php?cache=&media=image.jpg HTTP/1.1" 200 5 "http://dev/doku/lib/exe/detail.php?id=start&media=image.jpg"

I see the X-Accel-Redirect and correct mimetype headers are sent. Along with the image not displaying, shouldn't X-Accel-Redirect header read:

X-Accel-Redirect: /wiki/data/media/image.jpg

due to the alias directive?

What am I doing wrong?
Subject Author Posted

X-Accel-Redirect issues - Image of 0 size

habodal August 25, 2010 02:35AM

Re: X-Accel-Redirect issues - Image of 0 size

Maxim Dounin August 25, 2010 04:26AM

Re: X-Accel-Redirect issues - Image of 0 size

habodal August 25, 2010 11:40AM

Re: X-Accel-Redirect issues - Image of 0 size

Maxim Dounin August 25, 2010 12:08PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 77
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