我有如下配置,但我收到 500 错误。这个错误可能在哪里?
upstream masterservers {server 192.168.1.1:8000;}
upstream slaveservers {server 192.168.1.2:8001;}
map $request_uri $redirect_to {
"target=master" masterservers;
"target=slave" slaveservers;
}
server {
listen 80;
server_name 192.168.1.10;
location / {
proxy_pass http://$redirect_to;
}
}
当我如下调用 URL 时,出现以下错误。
http://192.168.1.10/app/index.html?target=master
http://192.168.1.10/app/index.html?target=slave
Nginx 日志:*2 invalid URL prefix in "http://", client: 192.168.1.11, server: 192.168.1.10, request: "GET /favicon.ico HTTP/1.1", host: "192.168.1.10", referrer: "http://192.168.1.10/app/index.html?target=master"