SOLVED SORTA Cross-Origin Request Blocked - Obviously I am missing something

Jelf

Member
Jun 26, 2016
24
3
53
Redmond
cPanel Access Level
Root Administrator
1. I confirmed mod_headers is enabled by doing
apachectl -M
That command showed headers_module (shared)

2. My main httpd file includes:
<Directory "/">
AllowOverride All
Options ExecCGI Indexes IncludesNOEXEC FollowSymLinks
</Directory>

I read in a thread that AllowOverride All might be needed for cross domain stuff to work.

3. I made the following small .htaccess file
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>

and placed it in this directory:

My goal is to be able to run PHP scripts located elsewhere and have them be able to access PHP code in the above directory. But I keep getting the error

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://192.163.244.163/_findmesar/php_get_elevation.php?lat=47.713485&lon=-122.067354. (Reason: CORS header ‘Access-Control-Allow-Origin' missing).

Any suggestion for what I am missing?
 
Last edited by a moderator:

Jelf

Member
Jun 26, 2016
24
3
53
Redmond
cPanel Access Level
Root Administrator
I think this is an SSL issue and the CORS error message was misleading.

I am using a free SSL cert from Lets Encrypt. Those certs cannot include IP addresses.
I lauched an html page from a Firefox tab and that page requested some PHP code from my IP address.
It was that request which caused the CORS error message.