Skip to content
Discussion options

You must be logged in to vote

The Request your loader gets is a Fetch API Request, and it has no notion of the remote address. The address lives on the Node/Express request. You pass it in through the load context, and that needs a server where you control getLoadContext.

The built-in react-router-serve has no such hook. It calls createRequestHandler({ build, mode }) without getLoadContext and does not set trust proxy (cli.ts). With it, the loader can't see the IP. Use a custom Express server instead; the official node-custom-server template already has one, and the Express adapter calls your getLoadContext(req, res) for every request (server.ts).

I checked this with React Router 8.5.1 (npx create-react-router@8.5.1 -…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@galaxor
Comment options

Answer selected by galaxor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants