[MAGNOLIA-7725] Allowing caching for error page Created: 20/Feb/20 Updated: 07/Apr/20 |
|
| Status: | Open |
| Project: | Magnolia |
| Component/s: | None |
| Affects Version/s: | 5.7.5 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Neutral |
| Reporter: | Jonathan Ayala | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| 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)
|
||||
| Date of First Response: | |||||
| Description |
|
It would be good to preserve cache-control headers when redirecting to error pages. This way it would be possible to take load off Magnolia by caching error-pages (404..) Detailed requirements from SUPPORT-10809 are:
|
| Comments |
| Comment by Horst L [ 01/Apr/20 ] |
|
@Jonathan Ayla Is it possible to extend this ticket to 301 and 302 responses? Currently it is not possible to include cache control headers for these responses either. But for our deployment scenario it would be helpful if we could also provide certain headers for these responses. // order of method calls changed, so that custom headers are applied to all responses processed by this method @Override public void replayHeadersAndStatus(HttpServletResponse target) throws IOException { //FIXME Start changed order of calls to write headers first target.setStatus(super.getStatus()); final Iterator it = super.getHeaders().keySet().iterator(); while (it.hasNext()) { final String header = (String) it.next(); final Collection values = (Collection) super.getHeaders().get(header); final Iterator valIt = values.iterator(); while (valIt.hasNext()) { final Object val = valIt.next(); RequestHeaderUtil.setHeader(target, header, val); } } target.setContentType(super.getContentType()); target.setCharacterEncoding(super.getCharacterEncoding()); target.setContentLength(super.getContentLength()); if (super.isError()) { if (errorMsg != null) { target.sendError(super.getStatus(), errorMsg); } else { target.sendError(super.getStatus()); } } else if (super.getRedirectionLocation() != null) { target.sendRedirect(super.getRedirectionLocation()); } else { target.setStatus(super.getStatus()); } // FIXME End } Is there a reason why for 302 reposes the headers set in Magnolia is only applied after the response has already been sent?
|