Hi everyone,
I need to authorize the BODY for the .ttf .eot .woff files.
I tried different solutions, but nothing works.
When I put this on my server configuration:
location ~ \.(eot|ttf|woff)$ {
add_header Access-Control-Allow-Origin "*";
}
I get a 404 error on the file.
When I put this in the first Location I have no more 404 error but still CORS
if ($request_filename ~* .(eot|ttf|woff)$){
add_header Access-Control-Allow-Origin "*";
}
server {
listen 443 ssl;
server_name www.xxx.xx;
root /home/www/public;
index index.php index.html index.htm;
client_body_buffer_size 10M;
client_max_body_size 10M;
location / {
try_files $uri $uri /app.php?$args;
rewrite ^/templates/([^/]+)/(?:[0-9]+)(?:(?:\.[0-9]+)+)?/(.*)$ /templates/$1/$2 break;
}
location ~^/api/([0-9]+\.[0-9]+)/ {
try_files $uri $uri /api.php?$args;
}
location ~ ^/(app|api)\.php(/|$) {
fastcgi_pass php-stream;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_read_timeout 60;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
internal;
}
location ~ \.php$ {
return 404;
}
}
Can you help me?
Thank you.
I need to authorize the BODY for the .ttf .eot .woff files.
I tried different solutions, but nothing works.
When I put this on my server configuration:
location ~ \.(eot|ttf|woff)$ {
add_header Access-Control-Allow-Origin "*";
}
I get a 404 error on the file.
When I put this in the first Location I have no more 404 error but still CORS
if ($request_filename ~* .(eot|ttf|woff)$){
add_header Access-Control-Allow-Origin "*";
}
server {
listen 443 ssl;
server_name www.xxx.xx;
root /home/www/public;
index index.php index.html index.htm;
client_body_buffer_size 10M;
client_max_body_size 10M;
location / {
try_files $uri $uri /app.php?$args;
rewrite ^/templates/([^/]+)/(?:[0-9]+)(?:(?:\.[0-9]+)+)?/(.*)$ /templates/$1/$2 break;
}
location ~^/api/([0-9]+\.[0-9]+)/ {
try_files $uri $uri /api.php?$args;
}
location ~ ^/(app|api)\.php(/|$) {
fastcgi_pass php-stream;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_read_timeout 60;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
internal;
}
location ~ \.php$ {
return 404;
}
}
Can you help me?
Thank you.