This might be a similar question to this one (Node.JS proxy with Nginx and Docker) but with some small difference. I want to run nginx directly on host and proxy-pass to a docker container running Nodejs.
This is the configuration block.
location /nodejs {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://172.17.0.2:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
I have nodejs container running at 172.17.0.2 with expose port on 3000. But using address "host_ip/nodejs" doesn't seem to forward correctly. Because if I do host port mapping, then "host_ip:3000" redirects to a login page "./login" which is correct. But "host_ip/nodejs" redirects only to "/".
This is the test using curl.
$ curl host_ip:3000
Found. Redirecting to ./login/
$ curl host_ip/nodejs
See Other. Redirecting to /
If I want to let "host_ip/nodejs" have the same effect as "host_ip:3000", what I have to do?
Thanks.
via user180574
No comments:
Post a Comment