A
A
akdes2015-03-15 18:08:18
PHP
akdes, 2015-03-15 18:08:18

Cross domain request from domain.com to api.domain.com... how?

Hi all.
Wrote a small api for my project.
From the main domain mydomain.com I call using angular api.mydomain.com... does not give a bastard. How to get around? How are public APIs made? In the future, I plan to make the api open.
There is a hosting. In configs they do not allow climbing.
Thanks in advance.
This is what the console outputs:
XMLHttpRequest cannot load api.mydomain.com/?login. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' mydomain.com ' is therefore not allowed access.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Osher, 2015-03-15
@akdes

XMLHttpRequest sends an OPTIONS request before sending a request to another domain.
He, in turn, should answer with the title:
You can see my detailed answer on stackoverlow.

S
Sergey, 2015-03-15
Protko @Fesor

CORS

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question