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

Removes port from target #985

Closed
2 tasks done
Netail opened this issue Apr 17, 2024 · 9 comments · Fixed by #989
Closed
2 tasks done

Removes port from target #985

Netail opened this issue Apr 17, 2024 · 9 comments · Fixed by #989

Comments

@Netail
Copy link

Netail commented Apr 17, 2024

Checks

Describe the bug (be clear and concise)

When a target with a port is given, it gets proxied to the domain without port.
E.g. when using http://127.0.0.1:3001 as a target, it will proxy to http://127.0.0.1

Step-by-step reproduction instructions

1. Set target to http://127.0.0.1:3001
2. Use the proxy 
3. Redirects to the url without the port

Expected behavior (be clear and concise)

Go to the correct port

How is http-proxy-middleware used in your project?

- "_project_#custom-proxy" depends on it
   - Hoisted from "_project_#custom-proxy#http-proxy-middleware"

What http-proxy-middleware configuration are you using?

3.0.0 - createProxyMiddleware()

What OS/version and node/version are you seeing the problem?

MacOS 14.4.1 - Node v20.8.1

Additional context (optional)

No response

@chimurai
Copy link
Owner

Can you share your server + proxy configuration?
Even better if can provide a reproducible example

@Netail
Copy link
Author

Netail commented Apr 19, 2024

Can you share your server + proxy configuration? Even better if can provide a reproducible example

Seems to be only the logging; https://codesandbox.io/p/devbox/gracious-lamport-jfds4x

If you visit the /api or /web path, you see it excludes the port in the logging

@max-holland
Copy link

@Netail Yeah, looks like it is just the logging. Initially I thought I had an issue with the proxy but that seems to be working as intended.

@Netail
Copy link
Author

Netail commented Apr 19, 2024

It also automatically adds a trailing slash to the target which could trigger an infinite loop when the web server has a redirect to the non-trailing slash path

@chimurai
Copy link
Owner

chimurai commented Apr 20, 2024

Thanks for reporting and the reproduction.
Merged a fix.


Trailing slash is added by the http-proxy lib.
Should be fixed upstream.

@chimurai
Copy link
Owner

chimurai commented Apr 20, 2024

published fix for port issue in 3.0.1-beta.0

@Netail
Copy link
Author

Netail commented Apr 20, 2024

Thanks for reporting and the reproduction.
Merged a fix.


Trailing slash is added by the http-proxy lib.
Should be fixed upstream.

Will you make a ticket there or shall I?

@chimurai
Copy link
Owner

Feel free to create a ticket 👍

@Netail
Copy link
Author

Netail commented Apr 21, 2024

Feel free to create a ticket 👍

Mhm I doubt it will be picked up, they haven't updated that library for over 4 years now, same for all the security issues

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

Successfully merging a pull request may close this issue.

3 participants