Skip to content

headers for dev-server not working anymore after upgrade from angular 16 to 17 #27464

@piu130

Description

@piu130

Which @angular/* package(s) are the source of the bug?

Don't known / other

Is this a regression?

Yes

Description

I've created a new angular 17 app with ng new angular-tour-of-heroes.
After adding custom headers in angular.json:

"serve" {
  "builder": "@angular-devkit/build-angular:dev-server",
  "options": {
    "headers": {
      "Cross-Origin-Opener-Policy": "same-origin",
      "Cross-Origin-Embedder-Policy": "require-corp"
    }
  }
}

they are not present in the initial localhost (index.html) request. All subsequent requests contains the headers.
When creating a new angular 16 app and adding the same config it works for the initial request as well.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

In the real code we see the error `Uncaught ReferenceError: SharedArrayBuffer is not defined` due to the missing headers.

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 17.3.4
Node: 20.12.1
Package Manager: npm 10.5.0
OS: win32 x64

Angular: 17.3.4
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1703.4
@angular-devkit/build-angular   17.3.4
@angular-devkit/core            17.3.4
@angular-devkit/schematics      17.3.4
@schematics/angular             17.3.4
rxjs                            7.8.1
typescript                      5.4.5
zone.js                         0.14.4

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions