Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions src/core/server/http/lifecycle/on_pre_routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,24 +102,7 @@ export function adoptToHapiOnRequest(fn: OnPreRoutingHandler, log: Logger) {
appState.rewrittenUrl = appState.rewrittenUrl ?? request.url;

const { url } = result;

// TODO: Remove once we upgrade to Node.js 12!
//
// Warning: The following for-loop took 10 days to write, and is a hack
// to force V8 to make a copy of the string in memory.
//
// The reason why we need this is because of what appears to be a bug
// in V8 that caused some URL paths to not be routed correctly once
// `request.setUrl` was called with the path.
//
// The details can be seen in this discussion on Twitter:
// https://twitter.com/wa7son/status/1319992632366518277
let urlCopy = '';
for (let i = 0; i < url.length; i++) {
urlCopy += url[i];
}

request.setUrl(urlCopy);
request.setUrl(url);

// We should update raw request as well since it can be proxied to the old platform
request.raw.req.url = url;
Expand Down