Skip to content

feat(http): origin without cookie - #37

Merged
petermasking merged 2 commits into
mainfrom
36-get-origin-without-cookie
Oct 29, 2026
Merged

petermasking merged 2 commits into
mainfrom
36-get-origin-without-cookie

Conversation

@basmasking

Copy link
Copy Markdown
Member

Fixes #34

Changes proposed in this pull request:

  • removed the cookie logic as it proofed to be unreliable

Bumped version (Y/N) : N

@basmasking basmasking linked an issue Oct 28, 2026 that may be closed by this pull request
Comment thread packages/http/src/OriginMiddleware.ts Outdated
#getOriginFromCookie(request: Request): string | undefined
{
const header = request.getHeader('cookie');
const host = request.getHeader('X-Forwarded-Host') ?? request.getHeader('host');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
const host = request.getHeader('X-Forwarded-Host') ?? request.getHeader('host');
const host = request.getHeader('X-Forwarded-Host') ?? request.getHeader('Host');

Comment thread packages/http/src/OriginMiddleware.ts Outdated
Comment on lines 31 to 34
if (protocol === undefined || host === undefined)
{
new URL(value);
}
catch
{
throw new BadRequest('Invalid origin');
throw new BadRequest('Missing headers');
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if (protocol === undefined || host === undefined)
{
new URL(value);
}
catch
{
throw new BadRequest('Invalid origin');
throw new BadRequest('Missing headers');
}
if (protocol === undefined)
{
throw new BadRequest('Missing protocol header');
}
if (host === undefined)
{
throw new BadRequest('Missing host header');
}

@petermasking
petermasking merged commit 996d8f1 into main Oct 29, 2026
10 checks passed
@petermasking
petermasking deleted the 36-get-origin-without-cookie branch October 29, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Get origin without cookie Release v0.2.1

2 participants