Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account for 'x-forwarded-proto' and 'x-forwarded-port' #169

Closed
zhawtof opened this issue Jan 27, 2025 · 0 comments · Fixed by #171
Closed

Account for 'x-forwarded-proto' and 'x-forwarded-port' #169

zhawtof opened this issue Jan 27, 2025 · 0 comments · Fixed by #171

Comments

@zhawtof
Copy link
Contributor

zhawtof commented Jan 27, 2025

Problem

Slack does not allow for http callbacks. However, it seems that when using a tunneled route (using VSCode ports personally), that the auth server is ignoring the forwarded protocol and the forwarded port.

Image

Relevant Code

export function getRelativeUrl(ctx: Context, path: string) {
const result = new URL(path, ctx.req.url)
result.host = ctx.req.header("x-forwarded-host") || result.host
return result.toString()
}

Necessary Changes

  • Account for x-forwarded-proto and x-forwarded-port
@zhawtof zhawtof changed the title Account for 'x-forwarded-proto' and 'x-forwarded-port Account for 'x-forwarded-proto' and 'x-forwarded-port' Jan 27, 2025
zhawtof added a commit to zhawtof/openauth that referenced this issue Jan 27, 2025
@thdxr thdxr closed this as completed in #171 Feb 3, 2025
thdxr pushed a commit that referenced this issue Feb 3, 2025
* Fixes #169 - adds forwarded proto and forwarded port

* remove pnpm lock file

* Supports forwarded protocol and forwarded port in the relative URL

* Update other locations with forwarded ports and protocols

* Remove unused forwards

* Undo import sort

* Update packages/openauth/src/issuer.ts

Removing the trailing slash as per raphaeltm's suggestion

Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>

---------

Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
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 a pull request may close this issue.

1 participant