Unity WebGL apache 2 sites
Hi, I have 2 Wordpress sites in the same server: chinchillareactor.com and unity.chinchillareactor.com. in unity... I am hosting a WebGL app accessing the Wordpress API from Chinchilla.
Asking for posts and media is doing it fine. However when I request pictures it is throwing me a CORS error. The method I use asking for pics is:
IEnumerator LoadPaintingContent()
{
using UnityWebRequest uwr = UnityWebRequestTexture.GetTexture(mediaItem.guid.rendered);
yield return uwr.SendWebRequest();
...
one of the pics URL I am using is: https://chinchillareactor.com/wp-content/uploads/2020/12/unityWordpress.jpg
my .htaccess has this config:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# BEGIN HttpHeaders
# The directives (lines) between "BEGIN HttpHeaders" and "END HttpHeaders" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_headers.c>
<IfModule mod_setenvif.c>
SetEnvIf Origin "^(https://.+chinchillareactor\.com/|https://unity\.chinchillareactor\.com/|)$" CORS=$0
</IfModule>
Header set Access-Control-Allow-Origin %{CORS}e env=CORS
Header append Vary "Origin" env=CORS
Header set Access-Control-Allow-Credentials "true" env=CORS
Header set Access-Control-Allow-Methods "GET, POST, OPTIONS" env=CORS
Header set Access-Control-Allow-Headers "Accept, X-Access-Token, X-Application-Name, X-Request-Sent-Time" env=CORS
<FilesMatch "\.(php|html)$">
</FilesMatch>
</IfModule>
How can I get rid of this error:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://chinchillareactor.com/wp-content/uploads/2020/08/sdb.png. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
cheers
Your answer

Follow this Question
Related Questions
Physics objects not working after build 0 Answers
WebGL Build Button still greyed out.,I'm not able to build WebGl version. 0 Answers
can I use a link to view a gameobject on unity webgl build? 0 Answers
il2cpp.exe did not run properly, a python compile error 1 Answer
EditorUtility.OpenFilePanel for UnityWebGL (Runtime) 1 Answer