Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular v18 - 404 on request

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 touched lately. The only thing which changed was basically the angular version, from 17.1.0 to 18.0.1. The https-proxy-agent package is v5 (I've also tried to update it to 7 but no changes).

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

like image 201
anyway07 Avatar asked May 18 '26 15:05

anyway07


2 Answers

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.

like image 177
M.S. Avatar answered May 21 '26 05:05

M.S.


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"
  }
}
like image 36
Kavinda Senarathne Avatar answered May 21 '26 05:05

Kavinda Senarathne



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!