Event Caching Does Not Preserve HTTP Response Codes

Description

Coldbox's event cache does not preserve the HTTP response code of the original request and will always return a 200 on subsequent requests.

To replicate the issue:
1. Create a new coldbox app.
2. Create a handler action that will respond with a 404 response code and uses event caching like this:

3. Load the page in your browser.

You will get a 404 code as expected on the first load. However, when you refresh the page, you will always get a 200 success code when the event originates from cache.

Attachments

3

Activity

Show:

David LevinSeptember 23, 2022 at 7:43 PM

Outstanding work ! It’s working in 7.0.0-beta-snapshot

Luis MajanoSeptember 23, 2022 at 9:31 AM

Ok, it’s on be now. Can you please check it.

David LevinSeptember 20, 2022 at 10:02 PM
Edited

Ugh, Adobe!

Nice work figuring it out regardless. I’m sure it was a frustrating process.

Luis MajanoSeptember 20, 2022 at 9:29 PM
Edited

Ok, I think I finally figured it out. Adobe’s response object sucks basically, I have to run things twice to get the actual status code.

If only they would adhere to the specs!! Not this double wrapping crap

David LevinAugust 18, 2022 at 9:07 PM

the fix in caused a regression of this issue. The status code is not preserved in local.refResults.eventCaching.statusCode therefore, it will never be set for the cached request. The value saved in local.refResults.eventCaching.statusCode always appears to be 0.

You can test this by adding a dump on line 263 on Bootstrap.cfc

Note: You probably know this, but any time you make a change to Bootstrap.cfc you must shut down the server and restart it for the changes to apply.

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Sentry

Created February 25, 2022 at 3:50 PM
Updated September 23, 2022 at 7:43 PM
Resolved June 17, 2022 at 5:06 PM