Skip to content

200 now returned for missing assets instead of 404 #26917

Closed
@jamesbrobb

Description

@jamesbrobb

Command

serve

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

16

Description

I've updated a project from 16.2.11 to 17.1.0

When an attempt to load a missing asset is made the response is a 200 containing index.html instead of the expected 404.

This happens when using ng serve to run development locally, but i'm also seeing the same issue when deploying my production build to a staging server.

Minimal Reproduction

https://github.com/jamesbrobb/v17-missing-asset-issue

Exception or Error

200 returned instead of 404 when asset does not exist

Your Environment

Angular CLI: 17.1.0
Node: 20.10.0
Package Manager: npm 10.2.3
OS: darwin x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1701.0
@angular-devkit/build-angular   17.1.0
@angular-devkit/core            17.1.0
@angular-devkit/schematics      17.1.0
@angular/cdk                    17.0.5
@angular/material               17.0.5
@schematics/angular             17.1.0
rxjs                            7.8.1
typescript                      5.2.2
zone.js                         0.14.3

Anything else relevant?

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