我正在尝试使用nginx作为前端(后端使用http)来建立一个负载均衡的,基于SSL的RESTful系统。我在获取完整的URL路径和一个参数到我的应用程序时遇到问题。
我在/ etc / nginx / sites-available / default中有这个:
upstream backend {
server 10.200.40.100;
server 10.200.40.101;
}
server {
listen 443;
server_name localhost;
ssl on;
ssl_certificate /etc/ssl/certs/reverse_chained_star_comtex_com.crt;
ssl_certificate_key /etc/ssl/certs/star_comtex_com.key;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
underscores_in_headers on;
ignore_invalid_headers on;
location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_pass http://backend?$args;
}
但是当我发送请求并在后端查看apache2访问日志时,我看到:
10.200.40.102 - - [03/Jul/2013:11:51:50 -0400] "GET /? HTTP/1.0" 401 478 "-" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36"
我应该看到这样的事情:
10.200.40.102 - - [02/Jul/2013:11:41:32 -0400] "GET /news/headlines/since/2013-07-02+01:00:00?api_key='xxxxxxx' HTTP/1.1" 401 4889 "-" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36"
我的论点中有一个下划线,这就是我使用underscores_in_headers的原因。什么想法可能会出错?