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

Full Request URL Data #3078

Closed
Crisfole opened this issue Dec 20, 2021 · 4 comments · Fixed by #3126
Closed

Full Request URL Data #3078

Crisfole opened this issue Dec 20, 2021 · 4 comments · Fixed by #3126

Comments

@Crisfole
Copy link
Contributor

Describe the problem

I redirect users to external auth providers that accept a redirect url as a query parameter. In order to do this from a hook I need to rebuild the url by combining the various pieces by hand and some environment information to determine protocol. This is inconvenient and doesn't easily allow using the platform.

Describe the proposed solution

I'd like a url: URL property on the ServerRequest. It does mean all the adapters need tweaking, but it feels like a reasonable need for a web server.

Alternatives considered

Building the full URL by hand.

Importance

would make my life easier

Additional Information

No response

@mohamadHarith
Copy link
Contributor

Hi Crisfole, you can get the entire URL of the page that makes the request from the headers using the request.headers.referer. Please see the attached image below.

image

@zyxd
Copy link

zyxd commented Dec 24, 2021

Unfortunately, request.headers.referer may not be defined, depending on the situation. The protocol is difficult to determine, since the application can work through a proxy, docker, etc.

It might be better to use a predefined environment variable with a URL like Vercel and Netlify do.

@Crisfole
Copy link
Contributor Author

Referrer is also supposed to be the url of the referring site, nut the current one...

@Rich-Harris
Copy link
Member

This will be fixed by #3126

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.

4 participants