Hello,
Is there by any chance a way make something like this?
location / {
try_files $uri $uri/ @fallback;
fastcgi_pass app;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include base/fastcgi_params;
if ($http_app_cache = "1") {
fastcgi_cache landingpage;
fastcgi_cache_key $http_host$request_uri;
fastcgi_cache_valid 200 2m;
fastcgi_cache_valid 404 1m;
fastcgi_cache_valid 500 1m;
fastcgi_cache_use_stale updating error timeout invalid_header
http_500;
fastcgi_ignore_headers Expires Cache-Control;
}
}
On Wed, Mar 24, 2010 at 12:14 AM, Tomasz P. [email protected] wrote:
Is there by any chance a way make something like this?
Can you try this?
location / {
if ($http_app_cache = "1") {
try_files $uri $uri/ @fallback;
fastcgi_pass app;
fastcgi_param SCRIPT_FILENAME
$document_root/$fastcgi_script_name;
include base/fastcgi_params;
fastcgi_cache landingpage;
fastcgi_cache_key $http_host$request_uri;
fastcgi_cache_valid 200 2m;
fastcgi_cache_valid 404 1m;
fastcgi_cache_valid 500 1m;
fastcgi_cache_use_stale updating error timeout
invalid_header http_500;
fastcgi_ignore_headers Expires Cache-Control;
break;
}
try_files $uri $uri/ @fallback;
fastcgi_pass app;
fastcgi_param SCRIPT_FILENAME
$document_root/$fastcgi_script_name;
include base/fastcgi_params;
}
Cheers,
-agentzh
this won’t work as well because try_files is not allowed in an if
statement
any other suggestions?
This works Maxim, thanks!
Hello!
On Tue, Mar 23, 2010 at 05:14:31PM +0100, Tomasz P. wrote:
if ($http_app_cache = "1") {
fastcgi_cache landingpage;
fastcgi_cache_key $http_host$request_uri;
fastcgi_cache_valid 200 2m;
fastcgi_cache_valid 404 1m;
fastcgi_cache_valid 500 1m;
fastcgi_cache_use_stale updating error timeout invalid_header http_500;
fastcgi_ignore_headers Expires Cache-Control;
}
}
Something like this should work:
location / {
error_page 403 = @cache;
if ($http_app_cache = "1") {
return 403;
}
try_files $uri $uri/ @fallback;
fastcgi_pass ...
...
}
location @cache {
try_files $uri $uri/ @fallback;
fastcgi_pass ...
fastcgi_cache ...
...
}
Maxim D.