nitro icon indicating copy to clipboard operation
nitro copied to clipboard

Inconsistent proxy behavior depending on route definition location

Open samydoesit opened this issue 2 years ago • 0 comments

Environment

nitro: 2.2.3 node: 18.14.2

Reproduction

Unfortunately, this doesn't work on Stackblitz. I just provided it for a quick overview Stackblitz Repro

If I run this locally on my machine, it works. Here is the repro also as a small zip. nitro-test-incosistent-behavior.zip

Describe the bug

Hi i am trying to proxy a js file using nitro. Depending on where I define the proxy, it behaves differently.

When the route (/service-worker.js) is defined in the nitro.config.ts as a routeRule, it doesn't work, and i always get {} as the response. However, when i define it as a file route (routes/service-worker2.js.ts), it works and i get the contents of the service-worker.

Additional context

No response

Logs

No response

samydoesit avatar Feb 23 '23 15:02 samydoesit