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

When app is passed through a proxy, RSC payload fails to load. #67444

Open
jmarioste opened this issue Jul 4, 2024 · 1 comment
Open

When app is passed through a proxy, RSC payload fails to load. #67444

jmarioste opened this issue Jul 4, 2024 · 1 comment
Labels
bug Issue was opened via the bug report template.

Comments

@jmarioste
Copy link

Link to the code that reproduces this issue

https://github.com/jmarioste/test-proxy-app

To Reproduce

In our company, many of our customers are institutions and/or universities that uses proxy to access our app. We recently refactored our app to next 14 app router but seems to not hydrate and doesn't work when passed through their proxy (e.g., ezproxy). Error: Connection closed. is thrown. I can't post the exact details because of confidentiality. I'll just use google translate as an example. This doesn't happen when using the /pages directory

  1. Go to a proxy website, in this case, i'm using translate.google.com
  2. Enter website: https://test-proxy-app.vercel.app/contact
  3. Go to https://test--proxy--app-vercel-app.translate.goog/contact?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=wapp&_x_tr_hist=true
  4. Check network tab. Notice that the RSC payload returns 400 HTTP error.
    image

Current vs. Expected behavior

Current behavior:

  1. When passed through a proxy service (ezproxy, etc) where a different domain is produced, app router fails to hydrate or the rsc payload fails to load in the network tab.
  2. Sometimes, Error: Connection closed. is thrown.

Expected behavior:

  1. rsc payload should not fail
  2. page should hydrate properly and there should not be any Error: Connection closed.

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Home Single Language
  Available memory (MB): 15792
  Available CPU cores: 16
Binaries:
  Node: 20.8.0
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 15.0.0-canary.54 // Latest available version is detected (15.0.0-canary.54).
  eslint-config-next: 15.0.0-canary.54
  react: 19.0.0-rc.0
  react-dom: 19.0.0-rc.0
  typescript: 5.5.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Not sure

Which stage(s) are affected? (Select all that apply)

Vercel (Deployed), Other (Deployed)

Additional context

This doesn't happen on pages directory, only app directory using react server components.

@jmarioste jmarioste added the bug Issue was opened via the bug report template. label Jul 4, 2024
@kaisic1224
Copy link

I believe that as you said, the error message only occurs on a proxy where the original url changes. I tested this on PlainProxies and there is no error through that proxy. However, the RSC fetch parameter is a hash that includes a header parameter called Next-Router-State-Tree which happens to be different from the original website and the proxied website.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

2 participants