Welcome! Log In Create A New Profile

Advanced

Cache per mime type PDF

Posted by Slydder 
Cache per mime type PDF
January 14, 2013 09:30AM
I have an nginx reverse caching proxy in front of an apache content server running magento. When I try and download a pdf from magento it takes between 15 – 60 seconds before it actually starts downloading. If I put a copy of the pdf on the nginx server and download it directly, or download it directly from the content server (minus the proxy), it goes as it should (fast). Does anyone have an idea why this is happening?

if the URI were an actual link to the PDF it would cache correctly however, it isn't. You can try downloading a pdf here: http://shop.haz.de/index.php/lanotattachments/download/file/id/4/

as you can see it is rather small but takes a while before it starts to download.

My current config is as follows

server {
server_name shop.haz.de;
listen 178.15.51.205:80;
add_header Cache-Control public;
access_log /var/log/nginx/shop.haz.de.access.log main;
error_log /var/log/nginx/shop.haz.de.error.log warn;
index index.php index.html index.htm;
limit_conn gulag 50;

## Only allow these request methods
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 444;
}

## PROXY - Web
# this prevents hidden files (beginning with a period) from being served
location ~ /\. { access_log off; log_not_found off; deny all; }


location ~* \.(jpg|png|gif|jpeg|css|js|mp3|wav|swf|mov|doc|xls|pdf|ppt|docx|pptx|xlsx)$ {
proxy_pass http://10.1.21.3;
proxy_pass_header Set-Cookie;
proxy_cache shop.haz.de;
proxy_cache_key backend$scheme://$host$request_uri;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
proxy_cache_valid 200 24h;
proxy_ignore_headers Expires Cache-Control;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location / {
proxy_pass http://10.1.21.3;
proxy_pass_header Set-Cookie;
proxy_ignore_headers Expires Cache-Control;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

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