You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The node request information has tons of additional information like connection (ip address) and some critical information which is required for building enterprise apps. While in the handle hook we only get pretty minimal information which is not useful for a lot of use cases.
Describe the proposed solution
One way I can think of, which is pretty straightforward is basically also send in the original node request in the handle hook.
so the event could have request => Sveltekit's request object, and another property called nativeRequest which would actually be the actual node request.
The apps can use the native request object to get the node information which is not available currently.
Alternatives considered
Another solution which I think could work is when building the new Request object, also pass any locals.
so request.locals = req.locals. This would enable developers using custom node / express server to use any middlewares and then pass down the computed values through req.locals to Sveltekit's request object.
This could even be extended to a list of properties instead of just locals which could be set in adapter-node
Importance
i cannot use SvelteKit without it
Additional Information
I am working on an enterprise level application, and this is a critical functionality we would need in order to distinguish internal & external requests and do some custom authentication for our internal requests. We cannot use Sveltekit without this feature.
The text was updated successfully, but these errors were encountered:
Describe the problem
Sveltekit's
handle
hook throws away actualnode
request, and only supplies very minimal request information.kit/packages/kit/src/node.js
Line 54 in 77590cb
The
node
request information has tons of additional information likeconnection
(ip address) and some critical information which is required for building enterprise apps. While in the handle hook we only get pretty minimal information which is not useful for a lot of use cases.Describe the proposed solution
One way I can think of, which is pretty straightforward is basically also send in the original node request in the
handle
hook.so the
event
could haverequest
=> Sveltekit's request object, and another property callednativeRequest
which would actually be the actual node request.The apps can use the native request object to get the node information which is not available currently.
Alternatives considered
Another solution which I think could work is when building the new Request object, also pass any
locals
.so
request.locals = req.locals
. This would enable developers using custom node / express server to use any middlewares and then pass down the computed values through req.locals to Sveltekit's request object.This could even be extended to a
list of properties
instead of justlocals
which could be set inadapter-node
Importance
i cannot use SvelteKit without it
Additional Information
I am working on an enterprise level application, and this is a critical functionality we would need in order to distinguish internal & external requests and do some custom authentication for our internal requests. We cannot use Sveltekit without this feature.
The text was updated successfully, but these errors were encountered: