Page 1 of 1

Access-Control-Allow-Origin

Posted: Tue Feb 19, 2019 5:34 pm
by MichalVl
Hi,
I have an e-shop in Opencart 2.2.0.0. The data are uploaded on http://webian.akis.cz/kukin/brother.nah ... z/opencart. I also have a domain tiskarny.nahradko.cz. On our server (webian.akis.cz) I have the virtual host. So if someone writes http://tiskarny.nahradko.cz the data from webian are displayed. If I run my eshop from webian, everything is OK. But if I run e-shop from tiskarny.nahradko.cz, the font-awesome disappear. In console I get
http://webian.akis.cz/kukin/brother.nah ... f2?v=4.4.0. (Reason: missing header CORS 'Access-Control-Allow-Origin')
. So I edited .htacces in /opencart root and I added

Code: Select all

<IfModule mod_headers.c>
  <FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|font.css|css)$">
    Header set Access-Control-Allow-Origin "*"
  </FilesMatch>
</IfModule>
at the end of this file. But it didn't help. So where do I make a mistake?

Re: Access-Control-Allow-Origin

Posted: Wed Feb 20, 2019 12:06 am
by IP_CAM

Code: Select all

<FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css|css)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
Put that Code way up in the .htaccess file, before the:

Code: Select all

# SEO URL Settings
RewriteEngine On
Ernie

Re: Access-Control-Allow-Origin

Posted: Wed Feb 20, 2019 3:16 am
by MichalVl
IP_CAM wrote:
Wed Feb 20, 2019 12:06 am

Code: Select all

<FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css|css)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
Put that Code way up in the .htaccess file, before the:

Code: Select all

# SEO URL Settings
RewriteEngine On
Ernie
Thank you for your answer, but it didn't help.

Re: Access-Control-Allow-Origin

Posted: Wed Feb 20, 2019 3:52 am
by OSWorX
Maybe read something like this:
https://stackoverflow.com/questions/106 ... oesnt-work

And a 'bit' more for the interested:
https://www.html5rocks.com/en/tutorials/cors/

Re: Access-Control-Allow-Origin

Posted: Wed Feb 20, 2019 4:36 am
by MichalVl
OSWorX wrote:
Wed Feb 20, 2019 3:52 am
Maybe read something like this:
https://stackoverflow.com/questions/106 ... oesnt-work

And a 'bit' more for the interested:
https://www.html5rocks.com/en/tutorials/cors/
Thank you, but still no change. :(

Re: Access-Control-Allow-Origin

Posted: Fri Nov 20, 2020 5:21 pm
by felixrebollo
Hello
I have the same problem with my domain. If Iif I access from http://www.ojoalgato.es icons disappear. With the same error: Acces-Control-Allow-Origin...
It seems that you could solved at the end.
I will be so gratefull if you tell me how you did it.
Thank you

Re: Access-Control-Allow-Origin

Posted: Fri Nov 20, 2020 6:10 pm
by OSWorX
felixrebollo wrote:
Fri Nov 20, 2020 5:21 pm
Hello
I have the same problem with my domain. If Iif I access from http://www.ojoalgato.es icons disappear. With the same error: Acces-Control-Allow-Origin...
It seems that you could solved at the end.
I will be so gratefull if you tell me how you did it.
Thank you
First of all, why loading fonts from: felixrebollo.es
Fix that, and the Icons will be displayed.
Otherwise you have to allow loading fonts from that site (while not really recommended).

Second: fix the "samesite" cookie (enough posts here how to).

Re: Access-Control-Allow-Origin

Posted: Fri Nov 27, 2020 12:00 am
by felixrebollo
thanks OSWorX
The reason si that my domain is felixrebollo.es and when I decided to set up the online shop I used this domain and web hosting.
Then I thought to made a new "branding" called ojoalgato.es and I used an alias.
As you can see, I don't have much knowledge of programming and all that.
I'll try this of the cookies.
Thank you very much

Re: Access-Control-Allow-Origin

Posted: Fri Nov 27, 2020 1:57 am
by felixrebollo
I ve solved my problem.
I'm sorry
It was a mistake. I'd redirected my alias to ojoalgato.es/opencart2 instead to felixrebollo.es/opencart2/index.php
So the first direction didn't find the icons.
It was my fault.
Thank you for your interest OSWorX and sorry again.

Re: Access-Control-Allow-Origin

Posted: Fri Nov 27, 2020 3:17 am
by OSWorX
felixrebollo wrote:
Fri Nov 27, 2020 1:57 am
I ve solved my problem.
I'm sorry
It was a mistake. I'd redirected my alias to ojoalgato.es/opencart2 instead to felixrebollo.es/opencart2/index.php
So the first direction didn't find the icons.
It was my fault.
Thank you for your interest OSWorX and sorry again.
Glad to hear that it works now.

Everyone can make a mistake, but not everyone can say that it was his mistake.