-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
What version of astro are you using?
1.0.0-beta.56
Are you using an SSR adapter? If so, which one?
Deno
What package manager are you using?
pnpm
What operating system are you using?
Mac
Describe the Bug
The Request object that can be read via Astro.request during SSR only contains a subset of the http.IncomingMessage. This means that properties like socket are not available and thus it's impossible to get the remote IP address of the client.
Reading the request IP is common for geo-related topics like geofencing content, adhering to local laws (eg. EU cookie consent), etc., and I can't currently come up with a valid workaround for this.
It looks like the createRequest function is responsible for this:
astro/packages/astro/src/core/request.ts
Line 17 in 4b0f27d
| export function createRequest({ |
This is both an issue when using the vite dev server as well as running a production server with the Deno adapter (and most likely all the other SSR adapters as well, but I might be wrong here).
I'm unsure if there are other valuable properties that are being stripped from the IncomingMessage, all I've noticed is the socket property.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-ufjx2c?file=src/pages/index.astro
Participation
- I am willing to submit a pull request for this issue.