-1

HTTP GET request changes into OPTIONS while adding headers in angular js

I have the same problem in Angular 4

  • The problem is because the app is at a domain, say `example.com`, different from the domain the service is at, say `api.com`. More details, refer here: https://stackoverflow.com/a/19821851/1850609 – acdcjunior Aug 08 '17 at 16:24

1 Answers1

1

Its called CORS, it has nothing to do with angular. Read up on the CORS spec, specifically the bit about simple request.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS

If you do not want the options pre flight request to be triggered you must not add custom headers.

Have a look at this for info in which headers are cors safe:

https://fetch.spec.whatwg.org/#cors-safelisted-request-header

rtn
  • 1,952
  • 4
  • 18
  • 36