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

Nitro adds trailing slash at the end of devProxy target #2659

Open
wokalek opened this issue Aug 13, 2024 · 2 comments
Open

Nitro adds trailing slash at the end of devProxy target #2659

wokalek opened this issue Aug 13, 2024 · 2 comments

Comments

@wokalek
Copy link

wokalek commented Aug 13, 2024

Environment



Reproduction

Set the settings from my settings described below and make sure that the proxy request is sent to the wrong url from nitro side.

Describe the bug

nuxt config:

nitro: {
  devProxy: {
    '/graphql': 'http://localhost:8000/graphql',
  },
},

The request from the browser goes to http://localhost:3000/graphql, but in the response I see (from Django) that the request came to http://localhost:3000/graphql/ and because my route on Django is set specifically to /graphql, it cannot be resolved.

I can add \/? to the expression on the backend side, but this is http://localhost:8000/graphql/ not what I wrote in the devProxy settings. This is a different url.

How to solve the problem? Or is it a bug?

Request in headers tab:
image

Request preview (Django response):
image
Django logs:
image

Additional context

No response

Logs

No response

@wokalek wokalek changed the title Nitro adds trailing slash at the end of devProxy Nitro adds trailing slash at the end of devProxy target Aug 13, 2024
@wokalek
Copy link
Author

wokalek commented Aug 13, 2024

After deeping down inside nitro and httpxy, the following setting helped:

  '/graphql': { target: 'http://localhost:8000/graphql', prependPath: false },

@wokalek wokalek closed this as completed Aug 13, 2024
@wokalek wokalek reopened this Aug 13, 2024
@wokalek
Copy link
Author

wokalek commented Aug 13, 2024

No, now it proxies requests to just http://localhost:8000. That's not what I need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant