-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add access to original request object in hook and endpoints #1615
Comments
Have you seen hooks? https://kit.svelte.dev/docs#hooks |
yes, but hooks also get access to just the same request of the endpoints, so no luck there. |
Client IP address is already available in the SvelteKit request. It's in the HTTP headers |
@benmccann can you provide docs/example? I only get host and origin headers. Nothing about an ip address |
What adapter are you using and where are you hosting it? |
For some reason I was expecting it to work in localhost. Dumb mistake xD |
Is your feature request related to a problem? Please describe.
Yes, we need to verify some IPs in the endpoints but there is no way to get that in the current state of svelte kit (please correct me if i'm wrong :)
Describe the solution you'd like
I love that the normal
Request
object is parsed by default so that for most of the endpoints/api there is no need to add middleware.However there might be cases where this is not enough, as for example getting the IP of the connectiong client.
Exposing the raw request as
rawRequest
e.g. could be a solution where most edge cases should become solvable. We already haverawBody
.Describe alternatives you've considered
None came to mind.
How important is this feature to you?
Quite important, withouth the ability to get the client IP we can not use kit for the current project unfortunately.
Additional context
Might be related to #1610.
The text was updated successfully, but these errors were encountered: