Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Fix defaultwebpage redirection caching

Discussion in 'Workarounds and Optimization' started by tylerl, Jun 6, 2012.

  1. tylerl

    tylerl Active Member

    Joined:
    Dec 11, 2009
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    51
    Solution:

    Add the following to to /usr/local/apache/htdocs/index.html
    Code:
    <meta http-equiv="Pragma" content="no-cache" />
    Ideally a better solution would be to modify either httpd.conf or the local .htaccess file such that this header would be sent as a header, but at least sending it as an http-equiv would be better than what we have now.

    Problem:

    When a domain isn't properly configured, the document in /usr/local/apache/htdocs/index.html redirects the browser to /cgi-sys/defaultwebpage.cgi -- which itself is a pretty bad idea to begin with... but even if you like that, what's really problematic is that this redirection is cached by the browser for that session.

    This means that when the domain is fixed (often done immediately in response to seeing that page), the user still can't see the correct page content because the redirection to defaultwebpage.cgi is cached client-side. So when the user types in the site URL, it immediately redirects to defaultwebpage.cgi without checking the server for an updated homepage.

    The typical user response in this type of situation is to hit "reload" on the browser to get an updated page -- and browsers are programmed to skip this session cache when a reload is requested. But the problem here is that the page that gets reloaded is defaultwebpage.cgi rather than the homepage URL -- remember that the homepage URL immediately redirects to defaultwebpage.cgi, so you can't hit "reload" before the redirect happens.

    The only solution is to close down all browser windows or manually clear the page cache, neither of which is something that the average shared hosting user would even think to try. The result is a lot of needless confusion due to a somewhat poorly thought-out design.

    And this is absolutely trivial to fix. Just instruct the browser to not cache the redirect page, and you're done.
     
  2. MilesWeb

    MilesWeb Well-Known Member
    PartnerNOC

    Joined:
    May 23, 2012
    Messages:
    173
    Likes Received:
    2
    Trophy Points:
    68
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Twitter:
    @tylerl Thanks for the share.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Silent Ninja

    Silent Ninja Well-Known Member

    Joined:
    Apr 18, 2006
    Messages:
    199
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    Buenos Aires, Argentina
    In case you want to add it on httpd.conf you'd need to edit the "/usr/local/apache/htdocs" Directory tag, and add this line:
    Code:
    Header set Cache-Control "no-store, no-cache, must-revalidate"
    And then execute this to save it permanently:
    Code:
    /usr/local/cpanel/bin/apache_conf_distiller --update
    PS: I've sent a new ticket (#2994458) to the cPanel guys to see if they can implement this fix and avoid these manual changes.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #3 Silent Ninja, Aug 2, 2012
    Last edited: Aug 2, 2012
  4. Travis-Mc

    Travis-Mc Registered

    Joined:
    Dec 21, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    51
    cPanel Access Level:
    Root Administrator
    Did anything ever come of that ticket?
     
  5. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,160
    Likes Received:
    370
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice