-4

I am running angular app in front and slim in back end but when hit the api url in browser its not working but in postman its working fine thanks!

Note

i have followed every related posts out there in stack overflow but still i did not get any solution

Access to XMLHttpRequest at 'http://school_erp_api.dev/login' from 
origin 'http://localhost:4200' has been blocked by CORS policy: 
Response to preflight request doesn't pass access control check: 
Redirect is not allowed for a preflight request.
Boni
  • 338
  • 2
  • 13

1 Answers1

0

Simply put, your backend needs to respond with an Allow-Origin header so that your preflight (OPTIONS request) passes and the server allows CORS. So, your backend should send Access-Control-Allow-Origin: <domain>, ... | *

For a way to implement this using slim, have a look here

thomi
  • 1,603
  • 1
  • 24
  • 31