Reputation
392
Top tag
Next privilege 500 Rep.
Access review queues
Badges
2 5 20
Newest
 Announcer
Impact
~58k people reached

Jun
5
awarded  Announcer
May
7
comment How do I add no-cache headers to all 404 pages served by apache and nginx?
I'm marking your answer as accepted. If someone wants to provide a more generic apache answer later, or an nginx one that works globally rather than per server, they can get upvoted.
May
7
accepted How do I add no-cache headers to all 404 pages served by apache and nginx?
May
7
comment How do I add no-cache headers to all 404 pages served by apache and nginx?
For apache, I decided that I actually wanted to use a custom page, so I did this: ErrorDocument 404 /path/to/my/404.php. And then inside the 404.php, I did <?php // do not cache 404 header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past ?>
May
7
comment How do I add no-cache headers to all 404 pages served by apache and nginx?
Clever. I am probably going to go with the other solution, since it already works and doesn't require a default Cache-Control header to be specified every time, but this was some thinking outside the box.
May
7
comment How do I add no-cache headers to all 404 pages served by apache and nginx?
Looks like omitting root works as well. If that's removed, it is pretty much what I ended up doing for nginx.
May
7
awarded  Yearling
May
7
comment How do I add no-cache headers to all 404 pages served by apache and nginx?
There are two issues here, but that's the direction I went with. 1. I didn't want to override the default 404 page and have to create rules in every listen since location is not supported inside http directly. 2. More importantly, your snippet actually doesn't work because add_header only applies to 20X and 30X (nginx.org/en/docs/http/ngx_http_headers_module.html). However, we're in luck, since as of the recently released 1.7.5, you can now add an always modifer which will apply it to all response codes. I had to upgrade nginx but it was a good kick in the butt. It works.
May
7
comment How do I add no-cache headers to all 404 pages served by apache and nginx?
So far, I am pretty sure that you can't override headers returned by default 404 handlers in both apache and nginx (please prove me wrong!). I was able to override the 404 handler and point it to a PHP file that sends such headers in apache, but since nginx doesn't have PHP support on my setup, and setting "expires -1;" on the 404 location didn't seem to actually do anything, I'm still at a loss as to how to do this in nginx.
May
7
comment How do I add no-cache headers to all 404 pages served by apache and nginx?
Similar question, though only for apache (still unanswered too): serverfault.com/questions/331544/….
May
7
asked How do I add no-cache headers to all 404 pages served by apache and nginx?
May
1
revised proxy:error AH00898: Error during SSL Handshake with remote server
Formatting doesn't work in code.
May
1
suggested approved edit on proxy:error AH00898: Error during SSL Handshake with remote server
Mar
19
awarded  Curious
Sep
16
awarded  Nice Question
May
21
awarded  Famous Question
Mar
28
awarded  Popular Question
May
30
awarded  Nice Question
Jun
2
comment illegitimate traffic from user agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)
@JohnGardeniers I would wager a bounty would be awarded to anyone who can identify the foe.
Mar
26
answered nginx: How can I set proxy_* directives only for matching URIs?