/serveStaleOnError doesn't work for 502 and 504 | Community
Skip to main content
yaraslaud208334
Level 2
Apr 28, 2018 1:46 PM UTC
Solved

/serveStaleOnError doesn't work for 502 and 504

According to How to serve stale content in case no render is available I have configured /serveStaleOnError on our dispatcher(apache 2.2 dispathcer 4.2.3/4.2.2).

For testing purpose I've created the following page:

<html>

    <head>

        <title>Throwing an Exception</title>

    </head>

    <body>

        <title>Throwing an Exception</title>

        <%

    response.sendError(503, "test failure" );

        %>

    </body>

</html>

serveStaleOnError  works fine for 503:

And doesn't work for 504,502:

What am I doing wrong? Should anything else be configured?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
joerghoh
joerghohAccepted solution
Employee
Apr 30, 2018 11:07 AM UTC

From what I understand, StaleOnError only works when it encounters one of these status codes:

* BAD_GATEWAY (502)

* SERVICE_UNAVAILABLE (503)

* GATEWAY_TIMEOUT (504)

So the functionality should be given in all your testcases.

Regarding your tests: Do you have a file /u/docroot/website.com/content/website/sitemap.styles.xml already in the filesystem, which can be delivered as stale file?

Jörg

5 replies

joerghoh
Employee
May 2, 2018 8:23 PM UTC

Hm, then I don't know. Can you raise a ticket at Adobe support and describe your findings?

thanks,

Jörg

Translate
yaraslaud208334
Level 2
May 2, 2018 9:02 AM UTC

Hello Jörg,

Yes I was verifying that files are cashed before I request it, but only 503 was returning content from cache.

When I was requesting resource with 502 and 504, cache was deleted and 502/504 status was returned on dispacher

Thank you,

Yaraslau

Translate
maxbarrass-anchora
New Participant
Nov 30, 2021 5:44 AM UTC

@yaraslaud208334 I can confirm that only 503 error code will force Dispatcher to return cached page. Rest of the error codes will remove your cached file. 

 

BONUS: If you are using ACS Commons Error Handler and have Throwable.jsp update its reponse status code to 503 to return cached page no matter what error you get.

 

@joerghoh can you tell us if there is any plans to opensource Dispatcher source code? It will make it so much easier to answer and fix these errors.

Translate
joerghoh
Employee
Dec 2, 2021 9:37 PM UTC

@joerghoh can you tell us if there is any plans to opensource Dispatcher source code? It will make it so much easier to answer and fix these errors.



Sorry, I cannot.

 

Translate
joerghoh
joerghohAccepted solution
Employee
Apr 30, 2018 11:07 AM UTC

From what I understand, StaleOnError only works when it encounters one of these status codes:

* BAD_GATEWAY (502)

* SERVICE_UNAVAILABLE (503)

* GATEWAY_TIMEOUT (504)

So the functionality should be given in all your testcases.

Regarding your tests: Do you have a file /u/docroot/website.com/content/website/sitemap.styles.xml already in the filesystem, which can be delivered as stale file?

Jörg

Translate