[MGNLIMG-317] Incorrect Content-Range Header when using ranged request Created: 05/Jul/23 Updated: 05/Jul/23 |
|
| Status: | Open |
| Project: | Imaging |
| Component/s: | None |
| Affects Version/s: | 3.5.6, 3.5.7, 3.5.8 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Theocharis Koktsidis | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Magnolia Version 6.2.27 up to 6.2.35 |
||
| Attachments: |
|
| 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: |
[X]*
Steps to reproduce, expected, and actual results filled
[X]*
Affected version filled
|
| Description |
|
While trying to setup Azure Front Door to serve cached images from imaging module we noticed that FD was unable to serve images served under /.imaging path in Magnolia. The root cause of that was identified as an incorrect Content-Range header value. Observe the faulty value below (Note: asset content length in the example below was ~65000) Steps to reproduce
> GET /.imaging/focalpoint/_WIDTH_x_HEIGHT_/{{YOUR_DAM_JCR_ASSET}} HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.84.0
> Accept: */*
> Range: bytes=0-1000000
* Mark bundle as not supporting multiuse
< HTTP/1.1 206
< X-Magnolia-Registration: Registered
< Cache-Control: max-age=600, public
< Expires: Wed, 05 Jul 2023 11:17:36 GMT
< ETag: 0CF063449C58CAE7CD3D4E28E1BAAAA1C265B2A6
< Accept-Ranges: bytes
< Content-Range: bytes 0-1000000/2147483647
< Content-Type: image/webp;charset=UTF-8
< Transfer-Encoding: chunked
< Date: Wed, 05 Jul 2023 11:07:37 GMT
Expected resultsObserve the results after implementation of workaround
> GET /.imaging/focalpoint/_WIDTH_x_HEIGHT_/dam/{{YOUR_DAM_JCR_ASSET}} HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.84.0
> Accept: */*
> Range: bytes=0-1000000
* Mark bundle as not supporting multiuse
< HTTP/1.1 206
< X-Magnolia-Registration: Registered
< Cache-Control: max-age=600, public
< Expires: Wed, 05 Jul 2023 11:20:31 GMT
< ETag: A583335CC1450A3D131BD8FE2FF9BB4599268724
< Accept-Ranges: bytes
< Content-Range: bytes 0-64065/64066
< Content-Type: image/webp;charset=UTF-8
< Transfer-Encoding: chunked
< Date: Wed, 05 Jul 2023 11:10:31 GMT
Actual resultsYou can find an output from the curl command under Steps To Reproduce WorkaroundThere are two possible solutions for this.
Development notesThe root cause of the issue seems to be that no length is set on the ServletImageResponse. This is going through the info.magnolia.cms.filters.RangeSupportFilter that sets the default value of Content-Range header because range values are not specifically provided in case of the imaging servlet. Have a look at RangeSupportFilter#processRange() |