D
D
Daniil Babkin2021-04-19 10:40:14
Apache HTTP Server
Daniil Babkin, 2021-04-19 10:40:14

Cross-site communication directives (CORS policy) for Apache - does not work on iOS. What is done wrong?

Hi 6) I have image files

on my hosting in the https://my-migration.com/files/images/social/ folder. I try to access them from the bulgaria.my-migration.com subdomain, but the files are not uploaded and I get the following warning:

Access to fetch at ' https://my-migration.com/files/images/social/viber.jpg ' from origin ' https://bulgaria.my-migration.com ' has been blocked by CORS policy: No 'Access -Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.


I added the following commands to htaccess:
<FilesMatch "\.(jpg|png)$">
  SetEnvIf Origin "^http(s)?://(.+\.)?(glideapps\.com|my\-migration\.com)$" origin_is=$0
  Header always set Access-Control-Allow-Origin %{origin_is}e env=origin_is
</FilesMatch>


Also, on the recommendation of the hosting support, I added another option:
Header set Access-Control-Allow-Origin "https://bulgaria.my-migration.com"


But both options work "every other time" - everything is ok on a PC under Windows, but not on the iPhone.

The question is - what is done wrong or what needs to be additionally taken into account for iOS?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Yuriev, 2021-04-19
@shtile

Header set Access-Control-Allow-Methods: "GET, OPTIONS"

explicitly specify which methods are subject to CORS headers

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question