Repository navigation
feat(redirect): isWebLinkRequest hook for hosts reserved for web links; remove web-only templates - #65
Merged
Conversation
…s; remove web-only templates A deployment can now mark a request's host as reserved for web links through RedirectRouteOptions.isWebLinkRequest. On such a host every link sends every device to its web destination with a plain 302: no Launchpad page, no scheme interstitial, no store. A hook that throws is logged and treated as false. This replaces the template-level webOnly flag from 1.29.0, which is removed along with isWebOnlyTemplate, buildAppleAppSiteAssociation and buildAssetLinks. The flag relied on excluding the template's path from the association files, but iOS and Android act on cached copies of those files for hours or longer, and Android 14 and earlier ignore the exclusions, so a link promised to stay on the web could still open the app. A host the app does not claim keeps every link in the browser at once, on every OS version, which a per-template flag cannot do. The well-known routes return to claiming every path.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Replaces the template-level
webOnlyflag from 1.29.0 (#64) with a host-level hook.Why
The template flag couldn't keep its promise. It relied on excluding the template's path from
apple-app-site-associationandassetlinks.json, but:So a link documented as "never opens the app" could still open it, with nothing an operator can do to speed that up.
What does keep a link in the browser immediately, on every OS version, is a host the app doesn't claim. The redirect still has to cooperate: without that, a mobile visitor on such a host can be sent to the Launchpad page or a store. That cooperation is now keyed on the host.
Changes
RedirectRouteOptions.isWebLinkRequest(request). When it returns true, every link sends every device to its web destination (the desktop destination:web_fallback_urlchain, elseoriginal_url, decorated with UTM, deep link parameters and click id) as a plain 302. No Launchpad page, no scheme interstitial, no store.web_link_host.llms.txt, with the advice to serve no association files on that host.settings.webOnlyon templates,isWebOnlyTemplate,buildAppleAppSiteAssociation,buildAssetLinksandAASA_EXCLUSION_BUDGET_BYTES. The well-known routes go back to claiming every path, without a database lookup.well-known.ts,templates.ts,types/index.tsandindex.tsare byte-for-byte what they were in 1.28.2.Compatibility
settings.webOnly: truestored is ignored.Tests
redirect.web-link.test.ts:pagemode and with store, scheme and Universal Link set;tscclean.