How to prevent error pages with status code 500 from being cached

serpent_driver

Well-Known Member
#1
Is there any known method to prevent error pages with status code 500 from being cached? Expressions to use them in .htaccess would do that, but are unsupported by LSWS. So what could help?
 

Pong

Administrator
Staff member
#2
500 error is most likely faulty .haccess , faulty php.ini or faulty PHP code. You will need to fix it first otherwise it will still return 500 even without purging cache. After you fixed the 500, you can purge the cache and it won't happen again. 500 is not like 503, you will have to fix it first.
 

Pong

Administrator
Staff member
#4
should be handled by the cache plugin side. cache plugin developer can decide to cache such page or don't cache such page. Preventing error page from cache is not a universal goal. Some error code code are intentionally cached by the developer to reduce the server load.

For example LSCWP, intentionally added cache for 403, 404, 500s. It is up to the cache plugin developer to evaluate.

https://wordpress.org/plugins/litespeed-cache/#developers

1.0.14 – JANUARY 30 2017
  • [NEW] Added error page caching. Currently supports 403, 404, 500s.
 

serpent_driver

Well-Known Member
#5
should be handled by the cache plugin side.
Yes, but there are not only cache plugins made by LiteSpeed. The world is greater than Wordpress and LSCWP. That's why I can't agree your philosophy about what should be cached or not.

Preventing error page from cache is not a universal goal.
Of course, it has to be a goal. There are more arguments not to cache pages that have no status 200 than to cache pages that have no status code 200.

Some error code code are intentionally cached by the developer to reduce the server load.
Again, there is no really reason why error pages should be cached. Reducing server load is not an argument. Caching pages without status 200 generates only junk and forces often re-caching to keep website content up to date.

My wislist for the future:

Either:
Code:
SetEnvIfExpr "%{REQUEST_STATUS} != 200" - [E=cache-control:no-cache]
Or:
Code:
Header set X-LiteSpeed-Cache-Control "no-cache"  "expr=%{REQUEST_STATUS} != 200"
 
Last edited:
#7
You may see an error on any web resource, browser, or device. It is not due to a lack of Internet connection, outdated operating system, or browser version. Also, the error does not indicate that the site does not exist or is no longer available. Error 500 means the server can not process a request to the site whose page you are on. The browser cannot tell you exactly what went wrong. I have not encountered such an error because I only go to the https://linebetappdownload.com site. If the error appears on your site, you must fix it as soon as possible.
 
Last edited:
#10
You may see an error on any web resource, browser, or device. It is not due to a lack of Internet connection, outdated operating system, or browser version. Also, the error does not indicate that the site does not exist or is no longer available. Error 500 means the server can not process a request to the site whose page you are on. The browser cannot tell you exactly what went wrong. If the error appears on your site, you must fix it as soon as possible.




To prevent error pages with a status code 500 from being cached, follow these steps. First, ensure that your web server is configured to send appropriate cache-control headers for error responses. Specifically, set "Cache-Control: no-store, no-cache" and "Pragma: no-cache" headers. This instructs browsers and caches not to store or serve cached copies of these error pages. Additionally, you can customize error pages to include cache-control headers, or use server-side scripting to add cache-control headers specifically for error responses. By implementing these measures, you can ensure that error pages with a status code 500 are not cached, providing a better user experience. P.S This tips are working for any website, including online casinos like https://mostbet-casino.in/
Yes, I faced such a problem, I solved it with the help of your service, thank you for such a valuable resource
 
Last edited:
Top