Skip to content

Commit

Permalink
Get correct protocol when creating request. (#966)
Browse files Browse the repository at this point in the history
This replaces defaulting to http which is not always correct nor safe.
  • Loading branch information
zimonitrome authored Aug 7, 2023
1 parent 925ea73 commit f89618d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/start/node/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,10 @@ class NodeRequest extends BaseNodeRequest {
}

export function createRequest(req) {
let protocol = req.headers["x-forwarded-proto"] || "https";
let origin = req.headers.origin && 'null' !== req.headers.origin
? req.headers.origin
: `http://${req.headers.host}`;
: `${protocol}://${req.headers.host}`;
let url = new URL(req.url, origin);

let init = {
Expand Down

1 comment on commit f89618d

@phouverneyuff
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change has break authjs in localhost, forcing to use HTTPS

Please sign in to comment.