Skip to content

Commit

Permalink
Preloader: Rename header to x-purpose to avoid it being stripped (#…
Browse files Browse the repository at this point in the history
…1108)

Co-authored-by: Alberto Fernández-Capel <[email protected]>
  • Loading branch information
pfeiffer and afcapel authored Jan 29, 2024
1 parent 67a191e commit b7187f1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/drive/preloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class Preloader {
// Fetch request delegate

prepareRequest(fetchRequest) {
fetchRequest.headers["Sec-Purpose"] = "prefetch"
fetchRequest.headers["X-Sec-Purpose"] = "prefetch"
}

async requestSucceededWithResponse(fetchRequest, fetchResponse) {
Expand Down
2 changes: 1 addition & 1 deletion src/observers/link_prefetch_observer.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export class LinkPrefetchObserver {
prepareRequest(request) {
const link = request.target

request.headers["Sec-Purpose"] = "prefetch"
request.headers["X-Sec-Purpose"] = "prefetch"

const turboFrame = link.closest("turbo-frame")
const turboFrameTarget = link.getAttribute("data-turbo-frame") || turboFrame?.getAttribute("target") || turboFrame?.id
Expand Down

0 comments on commit b7187f1

Please sign in to comment.