Repository navigation
Conversation
A Link preload header without an as destination never matches the request of the element, so the browser fetched every head resource again from the page. The destination now follows from the extension of the resource: style for css, script for js, and font with crossorigin for woff2, woff, ttf and otf. Other resources get no hint. The FacesServlet suffix mapping, path parameters and query string are stripped before the extension is read. The 103 interim response is only sent over HTTP/2 or later, because an HTTP/1.1 client or intermediary may take it for the final response (RFC 8297, section 3). The Link headers stay on the final response. The new org.glassfish.mojarra.disableEarlyHints context parameter switches off both. ExternalContextImpl.normalize(String) becomes private, as nothing outside the class calls it. Chrome only uses the preloads over a certificate it really trusts, not over one whose error it was told to ignore. That was verified by hand with a scratch CA. Issue5746IT runs on the self-signed certificate of the pooled server, so it asserts the content of the 103 instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #6159
A
Linkpreload header without anasdestination never matches the request of the element, so the browser fetches every head resource again from the page.ExternalContextImplnow derives the destination from the extension of the resource:stylefor css,scriptfor js, andfontpluscrossoriginfor woff2, woff, ttf and otf. Other resources, such as images, get no hint. The FacesServlet suffix mapping, path parameters such as;jsessionid, and the query string are stripped first.The 103 is only sent over HTTP/2 or later. An HTTP/1.1 client or intermediary may take a 103 for the final response (RFC 8297, section 3), and browsers only act on early hints over HTTP/2 anyway. The
Linkheaders stay on the final 200, where a CDN can still pick them up.The new context parameter
org.glassfish.mojarra.disableEarlyHints(defaultfalse) switches off both the headers and the 103. It is documented inCONTEXT-PARAMS.md.ExternalContextImpl.normalize(String)becomes private, as nothing outside the class calls it.Tests:
ExternalContextImplTest: the destination for each mapping kind, path parameters, case,nullmapping, the parameter, and the 103 for each protocol.Issue5746IT: no 103 over HTTP/1.1, while the 200 carriesLinkwithas; and over HTTP/2 the browser receives a 103 withrel=preload;as=for each head resource.DisableEarlyHintsIT: noLinkheaders when the parameter istrue.Chrome only uses the preloads over a certificate it really trusts. This was verified by hand with a scratch CA: every head resource then reports
initiatorTypeearly-hints. Withoutas, or with a certificate error that is only ignored, the element fetches the resource itself. The pooled IT server has a self-signed certificate, soIssue5746ITasserts the content of the 103 instead.🤖 Generated with Claude Opus 5.5