Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ETag header not properly delivered from the servlet (missing quotes) #2053

Closed
3 tasks done
8-bit-fox opened this issue Sep 20, 2019 · 0 comments · Fixed by #2054
Closed
3 tasks done

ETag header not properly delivered from the servlet (missing quotes) #2053

8-bit-fox opened this issue Sep 20, 2019 · 0 comments · Fixed by #2054
Assignees
Milestone

Comments

@8-bit-fox
Copy link

Required Information

  • AEM Version, including Service Packs, Cumulative Fix Packs, etc: 6.5.1
  • ACS AEM Commons Version: 4.3.2
  • Reproducible on Latest? yes

Expected Behavior

If I start a vanilla AEM with sample content and configure the ETag Digest Servlet filter as well as Apache/Dispatcher according to the manual, then I expect that subsequent requests to a cached resource (browser and dispatcher cache) returns a 304 status code.

Actual Behavior

When I curl cached resources with the header "If-None-Match: ${ETag}", I only receive the status code 200.

Steps to Reproduce

I start with a vanilla AEM including sample content (we-retail) together with the Apache/Dispatcher. The Servlet is configured as

# Configuration created by Apache Sling JCR Installer
messageDigestAlgorithm="MD5"
considerResponseHeaders=B"true"
salt=""
overwrite=B"false"
enabled=B"true"
addAsHtmlComment=B"true"
service.ranking=I"2147483647"
ignoredResponseHeaders=["Date","Cache-Control","Expires","Vary"]
enabledForOutputStream=B"true"
sling.filter.pattern=".*"

In the Apache, I adjusted conf.d/available_vhosts/aem_publish.vhost to contain

FileETag None

/conf.dispatcher.d/available_farms/999_ams_publish_farm.any to contain

/headers {
"Cache-Control"
"Content-Disposition"
"Content-Type"
"Expires"
"Last-Modified"
"X-Content-Type-Options"
"ETag"
}

in the /cache section.

Not that these filenames refer to a default web server setup provided by AMS. I set also in conf.dispatcher.d/filters/ams_publish_filters.any

/0001 { /type "allow"  /url "*" }

due to issues when accessing the webpage via the dispatcher (but this is not related to the issue at hand.

Then I browse to the ${dispatcher-vhost}/content/we-retail.htmland the site is rendered and cached. The headers are cached as well, including the ETag header and they are also delivered from the dispatcher to the client.

Subsequently, I send of a curl request, e.g.,

curl -k -I -A "test" --header 'If-None-Match: 87abc740b1dc88e4ecfb67f82e707fa8' http://aem-publish:4503/content/we-retail/us/en.header_include.html

As a result, I get a status code 200. Looking into the cached header, I see the content

Content-Type:text/html;charset=utf-8
X-Content-Type-Options:nosniff
ETag:87abc740b1dc88e4ecfb67f82e707fa8

According to this stackoverflow discussion, an ETag value field should contain a string. Therefore I change the cached header to

Content-Type:text/html;charset=utf-8
X-Content-Type-Options:nosniff
ETag:"87abc740b1dc88e4ecfb67f82e707fa8"

and curl

curl -k -I -A "test" --header 'If-None-Match: "87abc740b1dc88e4ecfb67f82e707fa8"' http://aem-publish:4503/content/we-retail/us/en.header_include.html

This time, I receive a status code 304, as desired. My suspicion is that the ETag servlet should answer with an ETag header as string and not as integer, such that the web server can cache it correctly.

@kwin kwin self-assigned this Sep 20, 2019
@kwin kwin added this to the 4.3.4 milestone Sep 20, 2019
@kwin kwin changed the title ETag header not properly delivered from the servlet ETag header not properly delivered from the servlet (missing quotes) Sep 20, 2019
kwin added a commit to kwin/acs-aem-commons that referenced this issue Sep 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants