I have the following code that works fine in my local environment. However, when I try to run the same code from the Docker container (via Boot2Docker), I just can't get to https: // [boot2docker_ip]: 4000
I tried updating the target value in the code below with all these parameters, but none of them seemed to do this trick:
target: 'http://localhost:3000',
target: 'http://0.0.0.0:3000',
target: 'http://127.0.0.1:3000',
target: 'http://<boot2docker_ip>:3000',
var fs = require('fs'); require('http-proxy').createProxyServer({ ssl: { key: fs.readFileSync(__dirname + '/certs/ssl.key', 'utf8'), cert: fs.readFileSync(__dirname + '/certs/ssl.crt', 'utf8') }, target: 'http://localhost:3000', ws: true, xfwd: true }).listen(4000);
I am using the node-http-proxy package from https://github.com/nodejitsu/node-http-proxy
Edit
Below is a git repo to try this behavior; I checked in fake SSL for simplicity.
Dockerfile:
FROM readytalk/nodejs ADD ./src /app ADD ./ssl-proxy /proxy COPY ./run.sh /run.sh RUN chmod +x /run.sh EXPOSE 3000 EXPOSE 4000 ENTRYPOINT ["/run.sh"]
run.sh:
source share