[MGNLCACHE-229] Cached REST Responses lose Content-Type header Created: 06/Jul/20  Updated: 20/Jul/20  Resolved: 20/Jul/20

Status: Closed
Project: Cache Modules
Component/s: None
Affects Version/s: 5.6, 5.6.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Horst L Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: cache, caching, rest
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

REST Responses stored and replayed from cache don't keep their original Content-Type header. This problem exists in Magnolia 5.7 and 6+.
If requests bypass the cache the Content-Type is set correctly, but if the response is stored in cache and then replayed the Content-Type header is lost.

For us this only happens for JSON responses we serve from a REST endpoint, but i think this happens to every response without an extension.

I think the problem is caused by the replay function in ContentCachedEntry.java. Here, the content type is always overwritten regardless of the current value of the response. If getContentType() returns a null value the original Content-Type will always be deleted.



 Comments   
Comment by Mercedes Iruela [ 20/Jul/20 ]

Hi Horst,

The issue that you are reporting seems similar to MGNLCACHE-38. This ticket has been already resolved and released in Magnolia 5.7.7, Magnolia 6.1.6 and Magnolia 6.2.1. What sounds strange to me is that Cache v5.9.1 shouldn't be affected by this since this version is including MGNLCACHE-38.

Regards,
Mercedes

Comment by Horst L [ 20/Jul/20 ]

Hi Mercedes,

thank you for your response, selecting 5.9.1 was an error on my side.

Thanks for the hint with MGNLCACHE-38, I have missed this ticket when I was looking for existing tickets with similar problems. We will update our cache module and check if the error still occurs.

Comment by Mercedes Iruela [ 20/Jul/20 ]

You are welcome, we are closing this ticket then, thanks for reporting issues in Magnolia and Help us to improve the product.

Generated at Sun Feb 11 23:53:28 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.