sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: terminal
Issue: Switching between buffers while a cooked read is active crashes conhost
Labels: Product-Conhost,Issue-Bug,Needs-Tag-Fix,Priority-1,Area-CookedRead

### Windows build number

10.0.26120.0

### Steps to reproduce

Run the following code:
```cpp
#include <Windows.h>

int main() {
    SetConsoleOutputCP(CP_UTF8);
    SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT);
    SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT | ENABLE_VIRTUAL_TERMINAL_PROCESSING | DISABLE_NEWLINE_AUTO_RETURN);

    // Disabled the alternate screen buffer while a cooked read is ongoing.
    CreateThread(
        nullptr,
        0,
        [](void*) -> DWORD {
            Sleep(1000);
            WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), "\x1b[?1049l", 8, nullptr, nullptr);
            return 0;
        },
        nullptr,
        0,
        nullptr
    );

    char buf[128];
    WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), "\x1b[?1049h", 8, nullptr, nullptr);
    ReadFile(GetStdHandle(STD_INPUT_HANDLE), &buf[0], 128, nullptr, nullptr);
    return 0;
}
```

and press any (visible character) key.

### Actual Behavior

The crash occurs because we don't cancel (or update) the pending cooked read in `SCREEN_INFORMATION::UseAlternateScreenBuffer` / `UseMainScreenBuffer`. Any version of conhost that supports alt buffers crashes with the above repro. Since support for ASB has existed for a while I'd not give this a P0, even if it's a stale pointer read (= bad, because unpredictable).
Repository: ollama
Issue: InternLM2.5 - hallucinations - lot of repetitions etc
Labels: bug

### What is the issue?

Seems like something is wrong with InternLM2.5, I can't get any meaningful out of it. (tried with 32k context) 


### OS

Linux

### GPU

Nvidia

### CPU

AMD

### Ollama version

v0.1.48
Repository: pytorch
Issue: ☂️ TORCH_INTERNAL_ASSERT failures while running CI
Labels: module: ci,triaged,module: assert failure,module: dynamic shapes

### 🐛 Describe the bug

Umbrella issue to track workarounds put while enabling testing with internal asserts:
1. `python3 ../test/test_nn.py -v -k test_native_channel_shuffle_return_alias_of_self` and `python3 ../test/test_nn.py -v -k test_TransformerEncoderLayer_empty_cuda` and `python3 ../test/test_transformers.py -v -k test_mem_efficient_attention_attn_mask_` fails https://github.com/pytorch/pytorch/blob/a9a744e442975cfbc6f4b26a532e5c1b3d9d5692/torch/csrc/autograd/autograd_not_implemented_fallback.cpp#L397

2. `python3 ../test/test_ops.py -v -k test_neg_conj_view__chunk_cat_cpu_complex128` hints following two internal asserts
https://github.com/pytorch/pytorch/blob/a9a744e442975cfbc6f4b26a532e5c1b3d9d5692/torch/csrc/autograd/autograd_not_implemented_fallback.cpp#L368-L370 and https://github.com/pytorch/pytorch/blob/a9a744e442975cfbc6f4b26a532e5c1b3d9d5692/torch/csrc/autograd/autograd_not_implemented_fallback.cpp#L372-L373

3. `python3 ../test/inductor/test_torchinductor_dynamic_shapes.py -v -k test_resize_as_dynamic_shapes_` fails with https://github.com/pytorch/pytorch/blob/e2e624a02fc2815047b0699acb8e0ba6a911229c/c10/core/SymInt.h#L228
4. `python3 ../test/test_torch.py -k test_parallel_cow_materialize_error_cpu_bfloat16` and  `python3 ../test/test_native_functions.py -v -k test_optional_` fails with https://github.com/pytorch/pytorch/blob/a9a744e442975cfbc6f4b26a532e5c1b3d9d5692/torch/csrc/autograd/autograd_not_implemented_fallback.cpp#L386-L387
5. `python3 ../test/inductor/test_cpu_repro.py -v -k test_multihead_attention_cpu` fails with https://github.com/pytorch/pytorch/blob/c9f1db265e317829b3a4d3af5be5c9266874dcd4/aten/src/ATen/native/transformers/attention.cpp#L418
6. `python3 ../test/test_nestedtensor.py -v -k test_unbind_backward_cuda_float16` fails at https://github.com/pytorch/pytorch/blob/c9f1db265e317829b3a4d3af5be5c9266874dcd4/aten/src/ATen/cuda/EmptyTensor.cpp#L71

7. Tons of test_jit(for example `python3 ../test/test_jit.py -v -k test_python_function`) crash while emitting ```pybind11::handle::inc_ref() is being called while the GIL is either not held or invalid. Please see https://pybind11.readthedocs.io/en/stable/advanced/misc.html#common-sources-of-global-interpreter-lock-errors for debugging advice.
If you are convinced there is no bug in your code, you can #define PYBIND11_NO_ASSERT_GIL_HELD_INCREF_DECREF to disable this check. In that case you have to ensure this #define is consistently used for all translation units linked into a given pybind11 extension, otherwise there will be ODR violations. The failing pybind11::handle::inc_ref() call was triggered on a method object.```

### Versions

Nightly

cc @seemethere @pytorch/pytorch-dev-infra @ezyang @penguinwu
Repository: TypeScript
Issue: Moving files or folders in a monorepo setup does not adapt imports
Labels: Bug,Help Wanted

<!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- 🕮 Read our guide about submitting issues: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions -->
<!-- 🔎 Search existing issues to avoid creating duplicates. -->
<!-- 🧪 Test using the latest Insiders build to see if your issue has already been fixed: https://code.visualstudio.com/insiders/ -->
<!-- 💡 Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. -->
<!-- 🔧 Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: Yes

<!-- 🪓 If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. -->
<!-- 📣 Issues caused by an extension need to be reported directly to the extension publisher. The 'Help > Report Issue' dialog can assist with this. -->
- VS Code Version: 1.90.0
- OS Version: Installed in Windows 10, Working in WSL 2 (Ubuntu 22.04)

Steps to Reproduce:

1. Create a monorepo setup that uses npm workspaces and typescript project references.
2. Create imports across workspace packages, e.g. import from @packageName.
3. Move a file or a folder that gets imported in various packages.

**Result**: Not all imports get adapted, you have to correct them manually. Especially imports in packages that are not involved in the move (other than source or target package) do not get adapted.

**Expectation**: All imports that reference the moved file or folder should get adapted automatically.

I really love VS Code but move refactorings are not really supported at the moment. IMHO this is a basic feature for a code editor and should also be supported for monorepo setups. I know several colleagues that moved away from VSCode to Webstorm for this reason.
Repository: TypeScript
Issue: TypeScript does not recognize unreachable code after a method returning never is called outside of its defining scope
Labels: Suggestion,Awaiting More Feedback

<!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- 🕮 Read our guide about submitting issues: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions -->
<!-- 🔎 Search existing issues to avoid creating duplicates. -->
<!-- 🧪 Test using the latest Insiders build to see if your issue has already been fixed: https://code.visualstudio.com/insiders/ -->
<!-- 💡 Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. -->
<!-- 🔧 Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: Yes

<!-- 🪓 If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. -->
<!-- 📣 Issues caused by an extension need to be reported directly to the extension publisher. The 'Help > Report Issue' dialog can assist with this. -->
- VS Code Version: 1.89.1
- OS Version: All

To Reproduce:

```
class SimpleThrower {
    public throwError(): never {
        throw new Error('');
    }

    public doSomething(): string {
        this.throwError(); // Directly call the never-returning function
        
        return 'Success'; // TypeScript recognizes that this line is unreachable
    }
}

() => {
    const example = new SimpleThrower();
    console.log(example.doSomething()); // This will throw an error
    example.throwError(); // Throws an error and stops execution
    console.log('foobar'); // TypeScript does not recognize that this line is unreachable
}
```
[Playground Link](https://www.typescriptlang.org/play/?#code/MYGwhgzhAEDKCWBbADiApgFQBYCcD2A7mjtAN4BQ0V0yArgEYjzDQAuuhAojvjgBQBKAFzQAdmgBuxMpWpz2+AmLRLuvPgHINAgNyyqAX3L6aDJiwAmeWHkRp28UQHNBIiKxyOnMufKzwIADoFLh48fl1oAHoo6AAReBw0YFYQAE9oYDAQEDYsNGUpHABaJNZaHFEvaAAzWlEU+DxREzlW6jKK0WgNWFpgYDQoDR1o2Iw05DRYYE9kVmgk4DwnKoAvIbywBYcYJnFoAOh6pLBgLDBGNBMjI3JBaABeAD4famXRd2g0AA8wFHQT2USgQAMwHCIET0cg+EDw6ECIBWfF+-1QaECVhsdgczkEkRi0GwRwI8ByeUU0DA3WIvBMqLBwQhanCglGhOwihg1O+YRI1Is0HceGQMF+yVorCaLRhzThCKRLg0NTweHoYBw2nZ40m01m8Hm0Csm1EeAWSxW6wK7G2eSO+wKRxOaDOFyu5AMQA)

Expected behavior:

TypeScript should recognize that the line console.log('foobar'); is unreachable after example.throwError(); is called, similar to how it recognizes the unreachable code within the doSomething method.

Actual behavior:

TypeScript does not mark the line console.log('foobar'); as unreachable after the example.throwError(); call in the global scope or within a different function scope.
Repository: vscode
Issue: Adapt to the .yml standard templates for new Github issues
Labels: feature-request,issue-reporter

<!-- ⚠️⚠️ Do Not Delete This! feature_request_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- Please search existing issues to avoid creating duplicates. -->

<!-- Describe the feature you'd like. -->

Hi, I found the Github issue templates less user friendly and would like to propose adapting the .yml standard.
https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms

Example:

```
name: Bug Report
description: Create a report to help us improve
labels: ["bug"]
body:
  - type: markdown
    attributes:
      value: |
       Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/
       🕮 Read our guide about submitting issues: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions
      🔎 Search existing issues to avoid creating duplicates.
       🧪 Test using the latest Insiders build to see if your issue has already been fixed: https://code.visualstudio.com/insiders/
      💡 Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information.
      🔧 Launch with `code --disable-extensions` to check.
  - type: textarea
    attributes:
      label: Description
      description: "Please provide a minimal example how to reproduce the problem and describe the expected outcome and what the actual outcome was."
      value: |
        ### What where you trying to do?


        ### What happened?


        ### What did you expect to happen?


    validations:
      required: true
  - type: input
    id: vscode_version
    attributes:
      label: VS Code Version
      description: "What is the version of VS Code that produced this problem?"
      placeholder: "x.x.x"
    validations:
      required: true
  - type: input
    id: os_version
    attributes:
      label: OS Version
      description: "What is the OS version were you running VS Code on when the problem occured?"
      placeholder: ""
    validations:
      required: true
```
Repository: go
Issue: encoding/xml: accepts various ill-formed XML
Labels: NeedsInvestigation

### Go version

`go version go1.21.11 linux/amd64`

### Output of `go env` in your module/workspace:

```shell
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/user/.cache/go-build'
GOENV='/home/user/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/user/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/user/go'
GOPRIVATE=''
GOPROXY='direct'
GOROOT='/usr/lib/golang'
GOSUMDB='off'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/usr/lib/golang/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.11'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3671854511=/tmp/go-build -gno-record-gcc-switches'
```

### What did you do?

https://go.dev/play/p/r8y4cgcybkS

### What did you see happen?

`encoding/xml` accepts ill-formed XML.

### What did you expect to see?

`encoding/xml` should reject all ill-formed XML.  Except for the last `tryUnmarshal()` call I linked, the constraints that it fails to check can be checked for without resolving namespaces, and therefore can be checked for even by `RawToken()`.

See:

- [ ] #8068
- [ ] #65691 
- [ ] #68294 
- [ ] #68295 
- [ ] #68296 
- [ ] #68297 
- [ ] #68332 
- [ ] #68385 
- [ ] #68386
- [ ] #68388 
- [ ] #68392 
- [ ] #68393 
- [ ] #68460
- [ ] #68499
- possibly more

Edit: removed #53728 because it is about serialization, not parsing.
Repository: go
Issue: encoding/xml: allows a colon before or after an XML name
Labels: NeedsInvestigation

### Go version

`go version go1.21.11 linux/amd64`

### Output of `go env` in your module/workspace:

```shell
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/user/.cache/go-build'
GOENV='/home/user/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/user/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/user/go'
GOPRIVATE=''
GOPROXY='direct'
GOROOT='/usr/lib/golang'
GOSUMDB='off'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/usr/lib/golang/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.11'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3671854511=/tmp/go-build -gno-record-gcc-switches'
```

### What did you do?

https://go.dev/play/p/KE2dyxD0acX

### What did you see happen?

`xml.Unmarshal` accepts `<:a/>`, `<a:/>`, `<a :b="c"/>`, and `<a b:="c"/>`.

### What did you expect to see?

`xml.Unmarshal` should return an error because `<:a/>`, `<a:/>`, `<a :b="c"/>`, and `<a b:="c"/>` are all ill-formed XML.  An XML name must not start or end with a colon.
Repository: go
Issue: encoding/xml: does not reject duplicate attribute names
Labels: NeedsInvestigation

### Go version

`go version go1.21.11 linux/amd64`

### Output of `go env` in your module/workspace:

```shell
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/user/.cache/go-build'
GOENV='/home/user/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/user/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/user/go'
GOPRIVATE=''
GOPROXY='direct'
GOROOT='/usr/lib/golang'
GOSUMDB='off'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/usr/lib/golang/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.11'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3671854511=/tmp/go-build -gno-record-gcc-switches'
```

### What did you do?

https://go.dev/play/p/TzV6Av9hMci

### What did you see happen?

`encoding/xml` accepted `<a a="" a=""/>`, even though it has duplicate `a` attributes and so is ill-formed.

### What did you expect to see?

`encoding/xml` should reject `<a a="" a=""/>` because it has duplicate `a` attributes and so is ill-formed.
Repository: go
Issue: encoding/xml: does not reject multiple attributes with the same namespace URL and local part
Labels: NeedsInvestigation

### Go version

`go version go1.21.11 linux/amd64`

### Output of `go env` in your module/workspace:

```shell
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/user/.cache/go-build'
GOENV='/home/user/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/user/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/user/go'
GOPRIVATE=''
GOPROXY='direct'
GOROOT='/usr/lib/golang'
GOSUMDB='off'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/usr/lib/golang/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.11'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3671854511=/tmp/go-build -gno-record-gcc-switches'
```


### What did you do?

https://go.dev/play/p/DvhR-1kQ5AR

### What did you see happen?

`encoding/xml` accepts the following ill-formed XML:

```xml
<!-- Ill-formed: both a:a and b:a have the same local part ("a")
     and namespace URL (https://example.com) -->
<a xmlns:a="https://example.com" xmlns:b="https://example.com" a:a="1" b:a="2"/>
```

### What did you expect to see?

`encoding/xml` should reject this XML when `Decoder.Token` is used, but accept it when `Decoder.RawToken` is used.
Repository: go
Issue: proposal: encoding/xml: reject ill-formed XML
Labels: Proposal

### Proposal Details

`encoding/xml` has multiple problems:

1. It does not check for XML well-formedness constraints: #68294, #68295
2. It does not check for XML namespace constraints: #68296, #68297
3. Its handling of XML namespaces is known to be buggy.

This proposal covers all issues linked by #68293.  These can all be fixed internally to `encoding/xml`, without changes to the API.  However, there will be new API on `xml.Decoder`:

```go
const (
	AllowLeadingColons = 1 << iota
	AllowTrailingColons
	AllowDuplicateAttributes
	// possibly other flags
)
	
/*
	Sets whether the parser allows ill-formed XML.
	Prior to 1.22, the parser always allowed ill-formed XML.
	Starting in 1.23, ill-formed XML is not allowed by default,
	but it can be re-enabled by calling decoder.AllowIllFormed(-1).
	The Allow* flags can be used for more fine-grained control.
*/
func (d *xml.Decoder) AllowIllFormed(flags int64)
```

and a `GODEBUG` flag `allow-ill-formed-xml=<bitmask>` for course-grained global control.

In the future, `xml.Decoder` will reject ill-formed XML.  If it is found to accept ill-formed XML, this will be considered a bug and fixed, with a new flag so that applications can opt-in to the old behavior.

Debug flags for `encoding/xml` may be removed with not less than two major versions notice.

My understanding is that this change is enough to guarantee round-trip stability for `RawToken` users (_not_ for `Token` users).  I believe that is possible to implement a namespace-aware, round-trip-stable parser correctly on top of the `RawToken` API, but the standard library does not currently implement such a parser.

~~This is essentially “merge #48641 + debug flags”.~~ this will require additional changes beyond this PR.
Repository: PowerToys
Issue: No funciona luego de actualizarlo
Labels: Issue-Bug,Needs-Triage

### Microsoft PowerToys version

0.82.0.0

### Installation method

Microsoft Store

### Running as admin

None

### Area(s) with issue?

General

### Steps to reproduce

No me deja usar ninguna combinación de teclas, solo aparece la imagen y no entiendo
![error](https://github.com/microsoft/PowerToys/assets/107158226/3de63461-9762-4a2c-b7a9-8a490f9cc1cc)


### ✔️ Expected Behavior

_No response_

### ❌ Actual Behavior

_No response_

### Other Software

_No response_
Repository: next.js
Issue: next.js 15 after() can not get response.body
Labels: bug,Middleware

### Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/delicate-cloud-h9jx3h

### To Reproduce

in middleware.ts , after() can not catch response.body

### Current vs. Expected behavior

Current : null 
Expected :"{a:123}"

### Provide environment information

```bash
Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Pro
  Available memory (MB): 16220
  Available CPU cores: 12
Binaries:
  Node: 21.0.0
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 15.0.0-canary.54
  eslint-config-next: 14.2.4
  react: 19.0.0-rc-e02baf6c92-20240627
  react-dom: 19.0.0-rc-e02baf6c92-20240627
  typescript: 5.5.2
Next.js Config:
  output: N/A
```


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

Middleware

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

next dev (local), next start (local)

### Additional context

_No response_
Repository: next.js
Issue: When app is passed through a proxy, RSC payload fails to load.
Labels: bug

### 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](https://translate.google.com/?sl=auto&tl=en&op=websites)
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](https://github.com/vercel/next.js/assets/10172560/52bdc5b9-2853-41c4-9eaf-d4a4f5ab77ff)


### 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

```bash
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.