I have a login button in the subdomain which is calling an AJAX request on main domain. In order to make CORS working I have to have the right domain which made the request in order to validate it on the main domain.
I can't use an exact subdomain because I have more than 3k subdomains which are all valid to make the request, and I also can't dynamically add them all to each request as it would burden it unnecessarily.
What I want is a method to pull out the referer somehow from the request, but the $_SERVER['HTTP_REFERER']
doesn't function always.
Is there some method which can fetch referer without exceptions each time so that I am sure that referer is set?
If not, is there a way to enforce attaching referer header to requests?