• 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

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