fix: preserve percent-encoded req.url in app event handler#1355
Conversation
`createAppEventHandler` was writing the decoded path (from `_decodePath`) back to `event.node.req.url`. This breaks HTTP proxies (e.g. Nitro dev server using httpxy) that forward `req.url` directly — they would send raw UTF-8 bytes instead of percent-encoded form, causing 400 Bad Request from downstream servers. Keep a separate `_rawLayerPath` derived from the original encoded URL and use it for `req.url`, while `event._path` continues using the decoded form for h3 internal routing and security checks. Closes h3js#1354
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks for PR. can you please also check failing CI 🙏🏼 |
Summary
createAppEventHandleroverwritingevent.node.req.urlwith the decoded path, which breaks HTTP proxies forwarding requests with percent-encoded UTF-8 characters._rawLayerPathderived from the original encoded URL forreq.url, whileevent._pathcontinues using the decoded form for internal routing.req.urlstays percent-encoded whileevent.pathis decoded.Test plan
req.url preserves percent-encoded UTF-8 charactersCloses #1354