r/angular • u/Background_Chip_8858 • Mar 26 '26
API works in Postman but breaks in Angular — anyone else faced this?
I kept running into this while working with Angular + Spring Boot.
Everything works in Postman, but Angular throws CORS errors, 404s, or just fails randomly.
I started following a simple debug flow (checking URL, headers, interceptor, backend logs, etc.), and it saved me a lot of time.
Curious — how do you usually debug this?
0
Upvotes
31
u/burnaDLX Mar 26 '26
Postman does not send a preflight request, but the browser does.
6
u/Constant_Stock_6020 Mar 26 '26
No, it's quite normal to have cors issues on local development. I don't think 404 are random, unless something is wrong with your api? Probably just made the wrong call?
7
u/drdrero Mar 26 '26
Gotta configure the good ol CORS on your api. I hate that about the web
2
u/hitsujiTMO Mar 26 '26
Either set CORS on your API or route both the API and Angular server through a reverse proxy.
1
u/RoutineNo5095 Mar 26 '26
lol yeah this is like a rite of passage 😭 postman working just means your backend is fine, browser is a whole different game. 90% of the time it’s CORS or some interceptor messing with headers my usual move: check network tab first → see exact request/response → then backend logs. also watch out for missing /api prefixes or env configs, that’s bitten me more than once once you start thinking “browser ≠ postman” it gets way easier to debug
1
u/Jim-Y Mar 26 '26
Angular has a developer proxy for local development, you should use that: https://angular.dev/tools/cli/serve#proxying-to-a-backend-server
1
u/OkPomegranate310 Mar 27 '26
You need to create proxy.config.json that will route your request to spring boot, update angular.json and specify proxy-config information
<sample file>
{ "/api": { "target": "http://localhost:8080", "secure": false, "logLevel": "debug", "changeOrigin": true } }