Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proxy route rules in 2.10 dev server force append base URL #2881

Open
wug-ge opened this issue Nov 14, 2024 · 1 comment
Open

proxy route rules in 2.10 dev server force append base URL #2881

wug-ge opened this issue Nov 14, 2024 · 1 comment
Labels
bug Something isn't working dev regression

Comments

@wug-ge
Copy link

wug-ge commented Nov 14, 2024

Environment

node v22.11.0
[email protected] (error happens from 2.10.0 onwards)

Reproduction

Install new nitro project with version 2.10.x, add the following to nuxt.config.ts:

baseURL: '/app',

routeRules: {
"/api/": { proxy: "http://localhost:3000/" },
},

Given it is just this few lines in a new project, I didn't make a reproduction. If you can't reproduce the issue, I'm happy to make one though.
Be aware that "localhost:3000" is another local running server not nitro itself. My nitro project is running on localhost:3002. Please replace with any http server.

Describe the bug

With v2.9.7 if you add a baseURL like : /app and a routeRule like mentioned above, a request to /api/orders would correctly query http://localhost:3000/orders.
Since 2.10.x this behavious has been changed and instead the following happens:

This might be intentional, but since it is a breaking change in a minor version I decided to report it here.

Additional context

I also opened the following issue in the Nuxt repo given I encountered the problem with Nuxt, but it is certainly nitro related after I tested it more: nuxt/nuxt#29915

Logs

No response

@pi0
Copy link
Member

pi0 commented Nov 14, 2024

Minimal reproductions:

This is a regression from #2713 which only affects dev server proxies.

I think we should solve it by redoing #2713 as a 404 fallback handler instead.

@pi0 pi0 added bug Something isn't working regression dev and removed pending triage labels Nov 14, 2024
@pi0 pi0 changed the title Breaking default behaviour in routeRules with baseURL updating from Nitro 2.9.7 -> Nitro 2.10.x proxy route rules in 2.10 dev server force append base URL Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dev regression
Projects
None yet
Development

No branches or pull requests

2 participants