Fix defaultwebpage redirection caching

tylerl

Active Member
Dec 11, 2009
28
0
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.
 

Silent Ninja

Well-Known Member
Apr 18, 2006
196
0
166
Buenos Aires, Argentina
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.
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.
 
Last edited: