Here is my server block from nginx.conf, I'm trying to rewrite my requests, which happens fine but my upstream hostname is not being set correctly, it always resolves to the actual IP address, but my API hosted as a virtual host in apache so end point always returns 500, any ideas how I can fix this?
listen 8090;
server_name example.dev.xyz.com;
set $api_path http://example-dev/api;
location ~ ^/api/ {
rewrite ^/api/(.*) /$1 break;
proxy_pass $api_path;
proxy_redirect off;
proxy_set_header Host $server_name ;
proxy_set_header X-Real-IP $remote_addr ;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
here are the details from nginx logs
...top/api-aggregator-master/sandbox/lua/system/sandbox.lua: in function <...top/api-aggregator-master/sandbox/lua/system/sandbox.lua:1> while sending to client, client: 127.0.0.1, server: example.dev.xyz.com, request: "GET /aggr/conversations HTTP/1.1", host: "localhost:8090"
2013/10/02 09:21:57 [warn] 27711#0: *8 an upstream response is buffered to a temporary file /Users/santthosh.selvadurai/Desktop/api-aggregator-master/sandbox/proxy_temp/4/00/0000000004 while reading upstream, client: 127.0.0.1, server: example.dev.xyz.com, request: "GET /aggr/conversations HTTP/1.1", subrequest: "/v1/GetTopicPage", upstream: "http://XX.XX.110.48:80/api", host: "localhost:8090"
2013/10/02 09:21:57 [error] 27711#0: *8 lua entry thread aborted: runtime error: ...top/api-aggregator-master/sandbox/lua/system/sandbox.lua:86: attempt to concatenate field 'function_to_call_file' (a nil value)
stack traceback:
coroutine 0: