Access-Control-Allow-Origin access control on server side Apache PHP

1

I do not understand much of PHP and I'm trying to create an application to automatically register products from my virtual store directly on eBay.

The ad data is captured with JavaScript and sent to the ML API via $.ajax , what happens is that images that are passed only the URL to the API are not uploading to the site, check URLs and are correct.

I tried to set the URL of the site logo (which is smaller) and it still does not go (I do not get any API return if the image was or not, it just does not appear in the ad). If I get the URL of an image from another site (I picked one from Wikipedia), it goes up correctly.

The virtual store is in PHP (Opencart) on Apache server, can this blocking be occurring on the server side by PHP or Apache?

    
asked by anonymous 14.06.2018 / 21:12

2 answers

-1

I was able to resolve by disabling CloudFlare's "Always use HTTPS".

    
14.06.2018 / 23:39
0

This is a lock type that occurs on the application server you can bypass by sending an inheritance that accepts all sources

header('Access-Control-Allow-Origin: *');  

Very important that this is called before anything else

Wrong

<html>
<?php
header('Access-Control-Allow-Origin: *'); 
?>

Correct

<?php
header('Access-Control-Allow-Origin: *'); 
?>
<html>
    
14.06.2018 / 21:31