• 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
  • Inviting everyone to the UX test of a new security feature in the WP Toolkit
    For WordPress site owners, threats posed by hackers are ever-present. Because of this, we are developing a new security feature for the WP Toolkit. If the topic of WordPress website security is relevant to you, we would be grateful if you could share your experience and help us test the usability of this feature. We invite you to join us for a 1-hour online session via Google Meet. Select a convenient meeting time with our friendly UX staff here.

Question Nginx origin setting for CDN cors problem

yunus çetiner

New Pleskian
I'm trying to add a directive on the Plesk panel for nginx, but unfortunately I can't find where to add it. I have a cors problem in fonts with CDN.


Code:
    location ~ \.(ttf|ttc|otf|eot|woff|font.css|css|js|gif|png|jpe?g|svg|svgz|ico|webp)$ {
           add_header Access-Control-Allow-Origin "*";
}

where should I add this code. I can't find any.
 
I'm trying to add a directive on the Plesk panel for nginx, but unfortunately I can't find where to add it. I have a cors problem in fonts with CDN.


Code:
    location ~ \.(ttf|ttc|otf|eot|woff|font.css|css|js|gif|png|jpe?g|svg|svgz|ico|webp)$ {
           add_header Access-Control-Allow-Origin "*";
}

where should I add this code. I can't find any.


Hi yunus çetiner,

That goes inside the section "Apache and nginx configuration" in the section "Additional nginx directives".

Or in its absence in the domain file vhost_nginx.conf
 
i added. after i create cdn. still not work.
0c6c69f592.png

f59d7cd84d.png
 
[QUOTE = "yunus çetiner, post: 856424, miembro: 187498"] Agregué. después de crear cdn. todavia no funciona
0c6c69f592.png

f59d7cd84d.png
[/CITAR]

Have you tried putting it this way?

add_header "Access-Control-Allow-Origin" "*";[/ QUOTE]
 
Last edited:
No, I haven't. In fact, this is exactly how I should add the code there.


Code:
location ~ \.(ttf|ttc|otf|eot|woff|font.css|css|js|gif|png|jpe?g|svg|svgz|ico|webp)$ {
           add_header Access-Control-Allow-Origin "*";
}

Is your code enough?
Code:
add_header 'Access-Control-Allow-Origin' '*';
 
No, I haven't. In fact, this is exactly how I should add the code there.


Code:
location ~ \.(ttf|ttc|otf|eot|woff|font.css|css|js|gif|png|jpe?g|svg|svgz|ico|webp)$ {
           add_header Access-Control-Allow-Origin "*";
}

Is your code enough?
Code:
add_header 'Access-Control-Allow-Origin' '*';

So I see the correct way to put it is with "
add_header "Access-Control-Allow-Origin" "*";
 
Back
Top