No 'Access-Control-Allow-Origin' header -- help me to solve it.
-
- Posts: 35
- Joined: Sat Sep 12, 2015 6:57 am
No 'Access-Control-Allow-Origin' header -- help me to solve it.
i have a website http://xookr.in and it has fonts that loads correctly.
but if i select a subdomain say for http://thanjavur.xookr.in the fonts are not loading and in console i see error No 'Access-Control-Allow-Origin' header.
i followed the below said steps in the below given url.
http://forum.vestacp.com/viewtopic.php? ... gin#p29791
i added the line
location ~ \.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$ {
add_header Access-Control-Allow-Origin "*";
in /home/user/config/web/nginx.conf
but even after adding it the fonts are not showing.
help me
but if i select a subdomain say for http://thanjavur.xookr.in the fonts are not loading and in console i see error No 'Access-Control-Allow-Origin' header.
i followed the below said steps in the below given url.
http://forum.vestacp.com/viewtopic.php? ... gin#p29791
i added the line
location ~ \.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$ {
add_header Access-Control-Allow-Origin "*";
in /home/user/config/web/nginx.conf
but even after adding it the fonts are not showing.
help me
Last edited by varunvijay on Sat Feb 06, 2016 11:30 am, edited 2 times in total.
-
- Posts: 35
- Joined: Sat Sep 12, 2015 6:57 am
Re: No 'Access-Control-Allow-Origin' header -- help me to solve it.
added it but not working,
Re: No 'Access-Control-Allow-Origin' header -- help me to solve it.
Silly question, do you restart nginx after adding new line in config?but even after adding it the fonts are not showing.
-
- Posts: 35
- Joined: Sat Sep 12, 2015 6:57 am
Re: No 'Access-Control-Allow-Origin' header -- help me to solve it.
ADDED and RESTARTED but not workingskurudo wrote: Silly question, do you restart nginx after adding new line in config?
-
- Posts: 35
- Joined: Sat Sep 12, 2015 6:57 am
Re: No 'Access-Control-Allow-Origin' header -- help me to solve it.
please help me i need to solve it ....
Re: No 'Access-Control-Allow-Origin' header -- help me to solve it.
and what writes in log domain error ? (errorlog)varunvijay wrote:please help me i need to solve it ....
-
- Posts: 35
- Joined: Sat Sep 12, 2015 6:57 am
Re: No 'Access-Control-Allow-Origin' header -- help me to solve it.
error log dont have any entry related to this.
but the console is giving error as below:
Font from origin 'http://xookr.in' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://thanjavur.xookr.in' is therefore not allowed access.
but the console is giving error as below:
Font from origin 'http://xookr.in' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://thanjavur.xookr.in' is therefore not allowed access.
-
- Posts: 35
- Joined: Sat Sep 12, 2015 6:57 am
Re: No 'Access-Control-Allow-Origin' header -- help me to solve it.
my nginx.conf
also contain this
location / {
proxy_pass http://myipaddress:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|tt f|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai| eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|m kv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/admin/web/website_name/public_html;
access_log /var/log/httpd/domains/website_name.log combined;
access_log /var/log/httpd/domains/mywebsite_name.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
do i have to edit this also or adding this
location ~ \.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$ {
add_header Access-Control-Allow-Origin "*";}
is enough
also contain this
location / {
proxy_pass http://myipaddress:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|tt f|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai| eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|m kv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/admin/web/website_name/public_html;
access_log /var/log/httpd/domains/website_name.log combined;
access_log /var/log/httpd/domains/mywebsite_name.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
do i have to edit this also or adding this
location ~ \.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$ {
add_header Access-Control-Allow-Origin "*";}
is enough