nitro icon indicating copy to clipboard operation
nitro copied to clipboard

Support event hooks for `devProxy` options

Open issue-up[bot] opened this issue 2 years ago • 4 comments

   Forwarded from downstream issue:

  • https://github.com/nuxt/nuxt/issues/20699 by @jiangmaniu

Describe the feature

The current devProxy can only set parameters of the ServerOptions type. I want to add some additional operations to the request header in Listening for proxy events. How can I achieve this?

Additional information

  • [ ] Would you be willing to help implement this feature?
  • [ ] Could this feature be implemented as a module?

Final checks

issue-up[bot] avatar May 06 '23 08:05 issue-up[bot]

Perhaps we could support registering proxies on nitroApp so they can be interacted with. wdyt @pi0?

danielroe avatar May 06 '23 08:05 danielroe

dev proxy is outside of the app and in (build space) dev server. We could directly support callback functions for it however or a hook.

pi0 avatar May 08 '23 09:05 pi0

+1 to this feature request. I've just struggled into a need of specifying proxyReq callback in order to forward cookies to the new destination while using followRedirects: true and it seems like there are no other ways to do this rather than via this potential feature.

nicky1038 avatar Mar 25 '24 21:03 nicky1038

+1

julschne avatar Jul 01 '24 12:07 julschne

I'm getting issues where specific, Nuxt-/Nitro-proxied requests return a 500 whereas non-proxied requests to the same endpoint do not. These seem impossible to debug / resolve without being able to inspect / alter the request before it is sent. Right now the request event happens after the request is sent, so I would like this.

matthew-dean avatar Feb 25 '25 16:02 matthew-dean