【发布时间】:2017-01-20 10:58:49
【问题描述】:
我正在使用 Ngnix 以下配置:
upstream sync {
server couchbase-sync:4984;
}
server {
listen 4984;
server_name ${WEBAPP_HOST};
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' '*';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
location / {
if ($request_method = OPTIONS) {
return 204;
}
proxy_pass http://sync;
}
}
我不想重定向 OPTIONS 请求,但我有一个错误:
nginx_1 | 2017/01/20 09:23:40 [emerg] 9#9: invalid condition "=" in /etc/nginx/conf.d/webapp.conf:13
nginx_1 | nginx: [emerg] invalid condition "=" in /etc/nginx/conf.d/webapp.conf:13
如何解决我的问题? Official Doc
感谢您的阅读
【问题讨论】:
-
此文件是否经过后处理?也许
$request_method字符串已损坏。试试nginx -T看看nginx看到了什么。
标签: nginx nginx-location