我正在尝试使用nginx作为代理服务器来获得一些不支持CORS的API。我配置的一部分:
server {
listen 8000;
server_name localhost;
merge_slashes off;
resolver 8.8.8.8;
location ~ ^/proxy/(.*) {
proxy_pass $1;
}
}但是它似乎没有传递GET参数,因为我得到的错误与提供none或无效GET时的错误相同:
$ curl -i 'http://localhost:8000/proxy/http://api.rottentomatoes.com/api/public/v1.0/lists.json?apikey=myapikey'
HTTP/1.1 403 Forbidden
Server: nginx/1.6.0
Date: Thu, 15 May 2014 15:33:40 GMT
Content-Type: text/javascript
Content-Length: 28
Connection: keep-alive
X-Mashery-Error-Code: ERR_403_DEVELOPER_INACTIVE
X-Mashery-Responder: prod-j-worker-us-east-1c-31.mashery.com
{"error":"Account Inactive"}我也不太明白通行证文件的意思。
发布于 2014-05-16 13:11:20
结果,我必须用$args手动传递GET参数
server {
listen 8000;
server_name localhost;
merge_slashes off;
resolver 8.8.8.8;
location ~ ^/proxy/(.*) {
proxy_pass $1?$args;
}
}https://stackoverflow.com/questions/23682822
复制相似问题