• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Font blocking due to Access-Control-Allow-Origin

Shiv

New Pleskian
Hello All,

I can see there is many answer for this issues, but all not working for me. show i am again asking here with my configurations.

Issue: Font blocking due to Access-Control-Allow-Origin

My .htaccess file:

Code:
RewriteEngine On
Options +FollowSymLinks
RewriteBase /

# Remove .php extension
RewriteCond %{THE_REQUEST} ^GET\ /[^?\s]+\.php
RewriteRule (.*)\.php$ /$1/ [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/(.+)/$
RewriteCond %{DOCUMENT_ROOT}/%1.php -f
RewriteRule ^(.*)/$ $1.php [L]


# Force trailing slash
RewriteCond %{REQUEST_URI}  !\.(php?|jpg|gif|png|css|js|html|json|xml|eot|svg|ttf|woff|woff2|zip|csv|xlsx|webp|txt)$
RewriteRule ^(.*)([^/])$ https://%{HTTP_HOST}/$1$2/ [L,R=301]

#Index to domain
RewriteRule ^(.*)index\.(php|html?)$ /$1 [R=301,NC,L]

RewriteEngine On
RewriteRule ^web-hosting/shared-linux-hosting/ shared-linux-hosting.php [L]
RewriteRule ^web-hosting/shared-linux-hosting/ shared-linux-hosting/ [L]
RewriteRule ^web-hosting/shared-windows-hosting/ shared-windows-hosting.php [L]
RewriteRule ^web-hosting/shared-windows-hosting/ shared-windows-hosting/ [L]
RewriteRule ^web-hosting/wordpress-hosting/ wordpress-hosting.php [L]
RewriteRule ^web-hosting/wordpress-hosting/ wordpress-hosting/ [L]
RewriteRule ^web-hosting/student-hosting/ student-hosting.php [L]
RewriteRule ^web-hosting/student-hosting/ student-hosting/ [L]
RewriteRule ^web-hosting/cloud-hosting/ cloud-hosting.php [L]
RewriteRule ^web-hosting/cloud-hosting/ cloud-hosting/ [L]

RewriteRule ^reseller-hosting/linux-reseller-hosting/ linux-reseller-hosting.php [L]
RewriteRule ^reseller-hosting/linux-reseller-hosting/ linux-reseller-hosting/ [L]
RewriteRule ^reseller-hosting/windows-reseller-hosting/ windows-reseller-hosting.php [L]
RewriteRule ^reseller-hosting/windows-reseller-hosting/ windows-reseller-hosting/ [L]
RewriteRule ^reseller-hosting/cloud-vps-reseller/ cloud-vps-reseller.php [L]
RewriteRule ^reseller-hosting/cloud-vps-reseller/ cloud-vps-reseller/ [L]

RewriteRule ^vps-hosting/openvz-vps/ openvz-vps.php [L]
RewriteRule ^vps-hosting/openvz-vps/ openvz-vps/ [L]
RewriteRule ^vps-hosting/kvm-vps/ kvm-vps.php [L]
RewriteRule ^vps-hosting/kvm-vps/ kvm-vps/ [L]

RewriteRule ^dedicated-hosting/self-managed-dedicated-servers/ self-managed-dedicated-servers.php [L]
RewriteRule ^dedicated-hosting/self-managed-dedicated-servers/ self-managed-dedicated-servers/ [L]
RewriteRule ^dedicated-hosting/fully-managed-dedicated-servers/ fully-managed-dedicated-servers.php [L]
RewriteRule ^dedicated-hosting/fully-managed-dedicated-servers/ fully-managed-dedicated-servers/ [L]

RewriteRule ^tos/customermasteragreement/ customermasteragreement.php [L]
RewriteRule ^tos/customermasteragreement/ customermasteragreement/ [L]
RewriteRule ^tos/registraragreement/ registraragreement.php [L]
RewriteRule ^tos/registraragreement/ registraragreement/ [L]
RewriteRule ^tos/customerdomainagreement/ customerdomainagreement.php [L]
RewriteRule ^tos/customerdomainagreement/ customerdomainagreement/ [L]
RewriteRule ^tos/customerwebserviceagreement/ customerwebserviceagreement.php [L]
RewriteRule ^tos/customerwebserviceagreement/ customerwebserviceagreement/ [L]
RewriteRule ^tos/customerdigicertagreement/ customerdigicertagreement.php [L]
RewriteRule ^tos/customerdigicertagreement/ customerdigicertagreement/ [L]
RewriteRule ^tos/customerhostingproductagreement/ customerhostingproductagreement.php [L]
RewriteRule ^tos/customerhostingproductagreement/ customerhostingproductagreement/ [L]


# "400 Bad Request",
ErrorDocument 400 /errordocs/
# "401 Authorization Required",
ErrorDocument 401 /errordocs/
# "403 Forbidden",
ErrorDocument 403 /errordocs/
# "404 Not Found",
ErrorDocument 404 /errordocs/
# "500 Internal Server Error",
ErrorDocument 500 /errordocs/
# "502 Bad Gateway error",
ErrorDocument 502 /errordocs/

# Redirect 404 pages to new correct url
Redirect /more-products/ssl-certificates/ /ssl-certificates/
Redirect /more-products/dedicated-hosting/ /dedicated-hosting/self-managed-dedicated-servers/
Redirect /about-cloud-hosting/ /about-ruralserver/
Redirect /client-area/ https://client.ruralserver.com/
Redirect /knowledgebase/ https://kb.ruralserver.com/

Redirect /knowledge-base-kb/ https://kb.ruralserver.com/
Redirect /blog/ https://kb.ruralserver.com/
Redirect /wp-content/themes/ruralserver/images/logo.png https://www.ruralserver.com/img/logo.png

RewriteRule ^wp-content/themes/ruralserver/images/logo.png$ https://www.ruralserver.com/img/logo.png [L,R=301]

# Browser caching

<IfModule mod_expires.c>
ExpiresActive On
AddType application/vnd.ms-fontobject .eot
AddType application/x-font-ttf .ttf
AddType application/x-font-opentype .otf
AddType application/x-font-woff .woff
AddType image/svg+xml .svg
ExpiresByType application/vnd.ms-fontobject "access 1 year"
ExpiresByType application/x-font-ttf "access 1 year"
ExpiresByType application/x-font-opentype "access 1 year"
ExpiresByType application/x-font-woff "access 1 year"
ExpiresByType image/svg+xml "access 1 year"
ExpiresByType text/html "access 1 hour"
ExpiresByType text/css "access 14 days"
ExpiresByType text/x-javascript "access 3 weeks"
ExpiresByType application/javascript "access 1 month" 
ExpiresByType application/x-javascript "access 1 month"
ExpiresByType image/gif "access 2 months"
ExpiresByType image/png "access 2 months"
ExpiresByType image/jpg "access 2 months"
ExpiresByType image/jpeg "access 2 months"
ExpiresByType image/gif "access 2 months"
ExpiresByType application/pdf "access 1 year"
ExpiresByType application/x-shockwave-flash "access 1 year"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|woff2|woff)$">
Header set Cache-Control "max-age=2592000, public"
</FilesMatch>

# Header protections
<IfModule mod_headers.c>
  Header set X-XSS-Protection "1; mode=block"
  Header always append X-Frame-Options SAMEORIGIN
  Header set X-Content-Type-Options nosniff

<FilesMatch "\.(xml|txt|css|js|woff|woff2|gz)$">
Header always set Access-Control-Allow-Origin "*"
</FilesMatch>

</IfModule>

# Begin cache control #
ExpiresActive on
ExpiresActive off
<FilesMatch ".*">
Header unset Cache-Control
Header unset Expires
Header unset Last-Modified
FileETag None
Header unset Pragma
</FilesMatch>
# End cache control

Additional nginx directives Code:

Code:
# enable gzip compression
gzip on;
gzip_min_length  1100;
gzip_buffers  4 32k;
gzip_types    text/plain application/javascript application/x-javascript text/xml text/css;
gzip_vary on;
# end gzip configuration

location ~* .(js|jpg|jpeg|gif|png|css|tgz|gz|rar|bz2|doc|pdf|ppt|tar|wav|bmp|rtf|swf|ico|flv|txt|woff|woff2|svg)$ {
    etag on;
    if_modified_since exact;
    add_header Pragma "public";
    add_header Cache-Control "max-age=31536000, public";
}

But still not working please help me.

My plesk licence if purchased from a reseller Plesk support is also not helping me. ans show message like this:

It was identified that your Plesk license was purchased not directly from Plesk but through one of the Plesk Resellers. In this case you need to ask for support from your license provider first. Plesk Partners (Resellers) are fully trained by Plesk and deliver best-in-the-industry support for Plesk products running on their infrastructure.

Please help me.

Thanks in advance
 
issues solved by:
Code:
Header set Access-Control-Allow-Origin "*"

I have put this on font server not on my site and its solved.

Thanks
 
Back
Top