location @again404 { add_header 'X-fallback' $uri; root /var/www/html/s5ci; try_files $uri $uri/ =204; } location @tryif404 { # rewrite ^(.*)/jobs/db/index.html$ $1/jobs/ break; rewrite ^(.*)/index.html$ $1/ break; # don't cache the static files add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; add_header 'X-fallback' 'yes'; add_header 'X-uri' $uri; expires off; proxy_pass http://kimsufi; proxy_intercept_errors on; error_page 404 = @again404; } location / { rewrite ^(.*)/$ $1/index.html break; # don't cache the static files add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; add_header 'X-fallback' 'no'; expires off; proxy_pass http://kimsufi; proxy_intercept_errors on; error_page 404 = @tryif404; }