我的nginx配置如下,我发现在status_code 200的时候会返回add_header
如果是其他状态码就不会返回,请问是我哪里配置有问题么?
server{
listen 80;
server_name ppt.com;
root /public;
index index.html index.php;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS,PUT,DELETE';
add_header Access-Control-Allow-Headers '*';
if ($request_method = 'OPTIONS') {
return 204;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
access_log ./nginx/ppt.server.log;
error_log ./nginx/ppt.server.error.log;
}
在add_header最后添加 always