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

Middleware proxy doesn't change the host header so can't be used with an API on a shared IP #6283

Open
djay opened this issue Sep 13, 2024 · 0 comments

Comments

@djay
Copy link
Member

djay commented Sep 13, 2024

Describe the bug
The middleware proxy in volto breaks with a connection refused if you the api path is set to api that uses the host header to direct the request.

To Reproduce

  1. Deploy the plone backend behind a proxy that uses a host header to direct the request. Say api.myapp
  2. Deploy the volto frontend to www.myapp and set the RAZZLE_API_PATH=https://api.myapp
  3. Requests to https://api.myapp/++api++ will fail (because they will be sent with "Host: www.myapp" not "Host: api.myapp".

Expected behavior

Set the right host header.

onProxyReq: (proxyReq, req, res) => {

Should also probably set X-Forwarded-Host etc - https://jdudzik.medium.com/posthog-reverse-proxy-with-node-express-js-480c1372f608

Screenshots
N/A

Software (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Volto Version [e.g. 8.5.0]
  • Plone Version [e.g. 5.2.2]
  • Plone REST API Version [e.g. 7.0.1]

Additional context
Add any other context about the problem here.

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