How to access a file hosted on another server

0

I am trying to access an .obj file with javascript that a different domain than the one it is hosted, by placing the url address of its location but I am returning the following error "missing the CORS header 'Access-Control-Allow-Origin' ), "I have access to the files of both domains but I can not find a way to use them without duplicating the files in the two locations. My question is: How can I solve it?

    
asked by pedro 10.11.2017 в 20:51
source

1 answer

0

In the folder where your files are housed you can create a file .htaccess with the following:

<FilesMatch "\.obj$">
    <IfModule mod_headers.c>
        Header set Access-Control-Allow-Origin "dominio.com"
    </IfModule>
</FilesMatch>

Where dominio.com is the domain from which you want to access. With a wildcard "*" you can give permissions to any domain.

Greetings.

    
answered by 10.11.2017 / 21:06
source