#### nginx.conf
http {
lua_package_path "./lua/?.lua;;";
resolver 8.8.8.8;
#Basic reverse proxy server upstream backend{ server http://0.0.0.0:5000/api/v1/ssjs; #some remote server }
server { listen 8080; lua_code_cache off; # for development only
location / { content_by_lua_file ./lua/nginx_ss.lua; }
#Proxy_pass the request to remote server location /v1/secure/proxy_shield_square/ { internal; resolver 8.8.8.8; #### Any remote server end-point proxy_set_header HOST $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://backend; #proxy_pass http://some.remoteserver.com/serverendpoint; }
}
#in nginx_ss.lua file . I am catching incoming req making some changes in header, setting new body and passing to location.capture
# /v1/secure/proxy_shield_square/ that is supposed to proxy pass my request to remote server
#############################################
# this is nginx_ss.lua
# body preparation as string in json format
local final_json = table.concat(api_table);--ngx.print(final_json);
ngx.req.read_body();
local res = ngx.location.capture("/v1/secure/proxy_shield_square/", { body = final_json });ngx.say("\n\n--------Response Headers from Remote server-------------");ngx.say("status : ", res.status);ngx.say("method : ", res.method);ngx.say("body :", res.body);
for k,v in pairs(res.header) do ngx.say(k,'-', v);end
##################################################Command to reload nginx conf
$ nginx -p `pwd` -s reload
nginx: [emerg] invalid host in upstream "http://0.0.0.0:5000/api/v1/ssjs" in /home/lautner/CodeCave/open_nginx/conf/nginx.conf:15
Is there is something wrong i am doing right now?
when i proxy_pass directly this http://0.0.0.0:5000/api/v1/ssjs , i am getting all request at this running server locally.
but when using upstream directive, it throwing this above error. Please someone having this knowledge regarding this issue, help me out? Thanks%--
You received this message because you are subscribed to the Google Groups "openresty-en" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openresty-en...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.