🐛 BUG: Automatic Link
header generation does not take into account base URL
#7181
Labels
bug
Something that isn't working
Which Cloudflare product(s) does this pertain to?
Pages
What version(s) of the tool(s) are you using?
3.84.1 (Wrangler)
What version of Node are you using?
No response
What operating system and version are you using?
N/A
Describe the Bug
Observed behavior
Let's consider an
index.html
page within a subdirectory/subdir
that contains:<base href="/">
: to provide/
as base URL for all links in the document<link rel="modulepreload" href="module.js">
: to preload themodule.js
The page is served through Cloudflare Pages.
Thanks to automatic
Link
header generation theLink
response header is added to the response as expected.The response contains the following
Link
response header:However
/subdir/module.js
preloaded doesn't exist. The intent is to preload/module.js
due to the base URL in the document.Expected behavior
The response should contain the following
Link
response header:Notice the slash
/
at the beginningSeems the base URL of the document isn't taken into account to generate the automatic
Link
response header.Steps to reproduce
Checkout a live site reproducing this:
https://cf-pages-hints-base.pages.dev/subdir/
You may inspect the source code and network requests to check out the generated
Link
header in the response is not the expected one.The source code & how to reproduce the site is in this repository:
https://github.com/davidlj95/cf-pages-hints-href
It's deployed using the main command to do so using
wrangler
Please provide a link to a minimal reproduction
https://cf-pages-hints-base.pages.dev/subdir/
Please provide any relevant error logs
N/A
The text was updated successfully, but these errors were encountered: