ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

System Offline header Status code

October 10, 2012 3:19pm

Subscribe [3]
  • #1 / Oct 10, 2012 3:19pm

    Gord W

    6 posts

    Hi

    I am running Expression Engine on a large CDN that I have little control over, and to make a long story short, the system offline page that returns a status code of 503 will not work for me.

    I will need to somehow adjust the header status of this page, but I’m pretty sure there are no built in options to do so.  Hacking core files is also not an option for me.  I was thinking about developing an extension, but was unable to find an appropriate hook.

    Any suggestions on how to modify this, or what hook might be an appropriate point to adjust the status code would be appreciated.

    Thanks

  • #2 / Oct 12, 2012 2:07pm

    Kevin Smith

    4784 posts

    Hi gmw01,

    What about the 503 status code from the system offline page is causing problems for you? That’s the proper status code when a site is temporarily offline or down for maintenance, which is why we’re using it there.

    There isn’t a way to change that in EE, but you could always set up your own PHP file to temporarily replace EE’s index.php file when you need the site to go down for maintenance.

  • #3 / Oct 12, 2012 3:55pm

    Gord W

    6 posts

    Hi Kevin

    I agree that is an appropriate status code for a site that is temporarily offline.  That said, we are in a situation where the CDN will automatically deliver its own “temporarily offline” message when it receives a status code of 503 from our webserver.  We also have a scenario where we want our EE powered site to be offline and show a custom message, along the lines of “Coming Soon” or “Down for maintenance”, that can be delivered while content is being populated and templates built etc. 

    In a single deployment, with a competent developer, I think your solution would work well, however, we hope to be deploying a solution for multiple EE powered sites administered by multiple people with a range of skills.  These sites could be considered high traffic, so we need an easy and effective way of going temporarily offline.

    As a feature request, I guess more settings for message pages would be useful for some users, but perhaps you have some alternate suggestions?

  • #4 / Oct 15, 2012 9:58pm

    Robin Sowell

    13255 posts

    I think for most folks, more settings in this case would mostly be confusing.  I like how the template_types hooks works- pretty much allowing devs to make any kind of template they want and send any type of header- but without added more cp complexity for the lay user.

    Unfortunately, system_off_msg() is pretty narrowly focused.  Which isn’t to say a hook couldn’t be added, it would just be very limited in scope.  Maybe set_status_header could be tweaked?

    I’ll admit, a beautiful solution hasn’t occurred to me.  But I have put in a feature request note.  The current behavior makes sense, but I do see where the ability to override would be desirable.

  • #5 / Nov 02, 2012 12:01pm

    Martin de Wit

    150 posts

    I am currently using the offline template as the homepage for an old site that is now being redesigned in EE. I just found out about the 503. I had no idea. I agree, it does makes sense to use a 503 but a warning at least would have come in handy. I totally didn’t expect this :-(

  • #6 / Nov 02, 2012 12:37pm

    Martin de Wit

    150 posts

    I now added this script to the beginning of the /index.php before any EE-code gets executed.

    <?php
    if ($_SERVER['REMOTE_ADDR']!="XX.XXX.XXX.XX") {
    include 'index-old-site.html';
    exit;
      } 
    ?>

    So now everyone will see index-old-site.html except for me. And you can add more IP addresses of course.

    There must me other methods. I’m very interested 😊

  • #7 / Nov 06, 2012 1:17pm

    Kevin Smith

    4784 posts

    The best methods to show visitors the old site would indeed be server-level so that the request is re-routed before it ever gets to EE, as you’ve done here. And thanks for sharing it, Martin!

    You might consider opening up a thread in Community Help to see how others go about solving this same question. Is there anything else I can help with here?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases