Angular v18 - 404 on request
Asked Answered
F

2

5

I've updated the Angular application to version 18 (18.0.1). I'm facing some issues regarding the http requests on localhost. For most of the requests I'm getting a 404. I'm behind a corporate proxy and I have a file configured which was not touch lately. The only think which changed was basically the angular version from 17.1.0 to 18.0.1.https-proxy-agent package is v5 (I've also tried to update it to 7 but no changes).

Did anyone faced similar issues? I don't know exactly what could be the problem and where to look.

Ferocious answered 5/7, 2024 at 6:58 Comment(0)
R
5

I had the same problem. After upgrading angular to 18.2.x most of request returns 404. Previous proxy.conf.json configuration looks like:

"/api/*": {

I changed to:

"/api": {

And my app is working.

Rhinarium answered 12/9, 2024 at 8:21 Comment(1)
You just saved my life, bless you.Chokedamp
I
1

Ensure that your proxy.conf.json file is correctly configured

    {
  "/api": {
    "target": "http://backend-server:port",
    "secure": false,
    "changeOrigin": true
  }
}

Make sure the angular.json file has the correct configurations

"serve": {
  "options": {
    "proxyConfig": "src/proxy.conf.json"
  }
}
Immensity answered 5/7, 2024 at 14:11 Comment(2)
It is configured as you say. It didn't changed before the update and was working. After the update... some requests are just failing with 404.Ferocious
Same problem here in my project. 404 errors when reaching out to backend via api. Any suggestions?Thump

© 2022 - 2025 — McMap. All rights reserved.