Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angular OPTIONS http preflight on "Same Domain"?

I am currently confused about how angular's (jquery) preflight OPTIONS call is "selected" or chosen to perform before a request.

I have a normal RESTful api call (api.domain.co)

I have created a host entry 127.0.0.1 local.domain.co in my hosts file /etc/hosts.

I've created self-signed certificate:

http://www.akadia.com/services/ssh_test_certificate.html

I've configured the certs in my mac as trusted:

http://abetobing.com/blog/port-forwarding-mac-os-yosemite-81.html

I've configured my Yosemite Port Forwarding Rules:

http://abetobing.com/blog/port-forwarding-mac-os-yosemite-81.html

I understand that from the browser's perspective (Chrome):

I have an angular app being loaded from https://local.domain.co with a trusted certificate that has a call to https://api.domain.co/user everything looks green with the cert, and I still get a preflight OPTIONS call to my api.domain.co server which is a node resitfy server with CORS support

Everything is Working... BUT

I want to get rid of the OPTIONS preflight Any pointers?

like image 749
Franky Diaz-Trepat Avatar asked Jul 12 '26 18:07

Franky Diaz-Trepat


1 Answers

unfortunately subdomain still affected by preflight rule so if you want to remove OPTIONS you can either using jsonp or have the same subdomain for both the site & api.

like image 61
kwangsa Avatar answered Jul 15 '26 07:07

kwangsa



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!