Nginx and rails maintenance pages, getting Squid 2.7 to not cache them, or alternatives to squid

I'm running Squid 2.7 on a load balancer and it seems to want to happily cache anything that comes its way, including (and especially annoyingly)maintenance pages.

The maintenance pages are served through a nginx error page hook, so I don't seem to have that much control over their cache headers, I'd like to just tell squid not to cache non 200 pages. Is there a way to do that without upgrading squid? (I know newer squid has a way to match the http status on acl rules)

The page itself already has meta tags for no cache, but that doesn't seem to help squid.

Here is the bit of config from nginx that sends the error page:

location / { passenger_enabled on; passenger_friendly_error_pages off; recursive_error_pages on; if (-f $document_root/system/maintenance.html) { return 503; } error_page 503 @503; } location @503 { if (-f $request_filename) { return 200; break; } error_page 405 = /system/maintenance.html; rewrite ^(.*)$ /system/maintenance.html break; }

Maybe there is a better way to do this on nginx end, or maybe some way to add extra stuff to these error pages ot make them behave better with squid.

The general idea is that if document_root/system/maintenance.html exists, the system is in maintenance mode and that page should be rendered for all requests (except static files so that the page can reference stylesheets or images or whatnot)

As for the squid end, I don't really have anything specific to show for it, its a pretty cookie cutter setup for a caching reverse proxy.



On a flip note, maybe there is a better alternative to using squid, I'm open to that suggestion too.

-------------Problems Reply------------

I know this isn't what you are looking for however something like this is much nicer on the system, this serves files then the maintenance page if it is in place then falls back to the backed server

try_files $uri $uri.html /maintenance.html @unicorn_story;

This does work well enough for us via squid but I would test it.

You could also clear squid after coming out of maintainance.

Category:ruby on rails Views:0 Time:2012-01-11

Related post

  • Rails: Display Maintenance Page if No Database Connection Available 2010-05-26

    I'm looking for a solution that will allow my rails app to render a user-friendly maintenance page when there is no Mysql server available to connect to. Normally a Mysql::Error is thrown from the mysql connection adapter in active_record. Something

  • nginx maintenance page with content issue 2011-05-12

    To show maintenance page during deploy I've always used next config in nginx: if (-f /home/shared/system/maintenance.html) { return 503; } error_page 503 @maintenance; location @maintenance { root /home/shared/errors; rewrite ^(.*)$ /maintenance.html

  • mod_rewrite rule to check for maintenance page except for certain subdomains 2009-03-18

    I have configured Apache to look for the presence of a maintenance page and redirect to that page if it is present: RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f RewriteCond %{SCRIPT_FILENAME} !maintenance. RewriteRule ^.*$ /system/maintena

  • How to configure maintenance pages on Passenger suburi deployments 2009-12-08

    I am trying to get a maintenance page setup for a suburi deployment on Phusion Passenger for a rails app. All the documentation shows DocumentRoot ReWrite rules, which don't appear (don't think they should) rewrite on suburis. I tried hacking around

  • NGINX 503 custom error page. How to? 2011-04-08

    Although I have found of lot of info on how to get NGINX to return 503 customer error pages I have not been able to find out how to do the following: Sample config file: location / { root www; index index.php; try_files /503.html = 503; } error_page

  • Passenger+Nginx show custom 500 page 2012-10-12

    I'm using Rails 3.2 with passenger+nginx. I want to display nice custom 500 page when the db server is down. I want to show something when my rails app cannot be started. Here is my nginx: server { listen 80; server_name localhost; root /var/www/stor

  • Automated Apache Server Maintenance Page 2008-09-18

    I have a website running on a Linux/Apache/Tomcat stack that needs to be automatically taken offline every few months for server maintenance, which will last an arbitrary amount of time. What are some options for getting Apache to put up and take dow

  • How do I stop search engines indexing a maintenance page 2009-04-07

    I need to setup a maintenance page for a website I'm running, e.g. for display when I'm performing site maintenance (scheduled downtime) or if something really breaks and I need to put up a holding page. Is there anything special I need to do to ensu

  • How to show maintenance page during deployment? 2009-05-04

    I want to plan a schedule maintenance down time on one of my production asp.net website hosted on IIS windows server 2003. I think this is the preferred behavior: All request to http://www.x.com including www.x.com/asb/asd/ will be redirected to a no

  • Zend Framework "under maintenance" page 2009-06-15

    I'm trying to figure out how to set up a holding/"under maintenance" page in Zend Framework for when I am upgrading the database or something and don't want anyone using the site. I'd like to have a static HTML page and have all traffic redirected to

  • Recommended File Extension for rails view pages(2.3.2) 2009-08-28

    Which is the Recommended File Extension for rails view pages(2.3.2) 1.RHTML 2.html.erb any significance in this. --------------Solutions------------- The standard naming: template_name.mime_type.erb Significance: The controller will look for appropri

  • How can I show a maintenance page when my FastCGI app is restarting? 2009-11-05

    I am serving my FastCGI application in Apache2 using the standalone FastCGI server and the FastCgiExternalServer directive. When I restart my FastCGI app my users get a 500 error. What can I do to prevent this? I want to show them a nice 'maintenance

  • Proper status code for a maintenance page redirect? 2009-11-09

    While performing some upcoming maintenance, I'm going to have to redirect all site traffic to a maintenance page briefly. What's the proper status code to use for the redirect? 503 makes sense, but it's not technically a redirection status. 302 is a

  • how to embed a linux bash terminal inside ruby on rails web page? 2010-10-13

    how to embed a bash prompt/terminal inside ruby on rails web page? how to execute a linux command from the web page, and get the output of the ommand? --------------Solutions------------- You must be looking for answers in this question: Terminal on

  • Down for maintenance page? 2011-01-03

    I want to create a down for maintenance page in asp.net mvc so whatever the request is it will point it to Home/Down What router configs I need to set in global.cs file? --------------Solutions------------- You could use an App_Offline.htm file. Simp

  • Redirect tomcat to maintenance page when down 2011-01-04

    I'm using tomcat6 with mod_jk setup(both running at port 80) on ubuntu9.10 and 8.10 servers. I deploy war files under /usr/share/tomcat/webapps. During deployment, as I restart the tomcat, I will get the following page when the tomcat application is

  • MSDeploy and "site under maintenance" page 2011-01-26

    I am new to MSDeploy as well as IIS admin. In order to show a "site under maintenance" page we are looking at two alternatives. 1) Have an app_Offline.htm page and sync it to the server when maintenance starts. 2) Create a separate folder with a tota

  • Redirect to maintenance page in CakePHP doesn't work 2011-07-21

    I am trying to set a maintenance page so that when the site is disabled, it should appear no matter what page was requested. I currently tried doing this with $this->cakeError(): in app_controller.php: function beforeFilter(){ .... if($this->__

  • Maintenance page forwarding with htaccess does not work for proxied material 2011-11-18

    I have scoured the internet and am at a loss as to why my maintenance page redirect and rewrite rules do not work for any proxied material or anything that is coming across through https. I am using an Apache 2.2.3 server with tomcat 6.0.24 installed

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.072 (s). 11 q(s)