I have a REST service with an endpoint ‘registrations' running in a Docker container and it maps port 5000 to port 5001 on the Docker host.
My /etc/nginx/conf.d/default.conf contains:
upstream registration-api {
server registration:5001 ;
}
server {
listen 80;
server_name "";
# Registration Service
location /registrations/ {
proxy_pass http://registration_api/;
}
}
—
I’m using Docker, so ‘registration-api’ is defined in the nginx container’s /etc/hosts file.
My Docker host is running at 192.168.99.100. I can run:
curl -v http://192.168.99.100:5001/registrations/
and I get the response I am expecting.
However, when I try to go through nginx reverse-proxy with the command:
curl -v http://192.168.99.100/registrations/
I get the following redirect:
* Trying 192.168.99.100...
* Connected to 192.168.99.100 (192.168.99.100) port 80 (#0)
> GET /registrations/ HTTP/1.1
> Host: 192.168.99.100
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Server: nginx/1.9.12
< Date: Fri, 25 Mar 2016 23:57:20 GMT
< Content-Type: text/html
< Transfer-Encoding: chunked
< Connection: keep-alive
< Location: http://localhost
< Expires: Fri, 25 Mar 2016 23:57:19 GMT
< Cache-Control: no-cache
<
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>
* Connection #0 to host 192.168.99.100 left intact
Any help would be appreciated,
Thanks,
Rowlad
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx