Using Pushpin on docker with a localhost backend

I am running pushpin on docker using a localhost:8080 backend. I am running pushpin on port 7999 and my etc/pushpin/routes file includes the entry
* host.docker.internal:8080
in order to subscribe to the Pushpin proxy, the proxy forwards the request to the origin server. To set this into motion I use curl -v "http://0.0.0.0:7999/api/chat-stream?roomId=example-room" -H "Accept: text/event-stream"
but I either get a 502 Bad Gateway, or I don’t get a status code response at all. When I try to bypass the pushpin proxy and use a dummy value for my “Grip-Sig” header the backend connection is successful and the streaming works with a 200 response.

I think the problem might be with my routes files, but i’m not sure. Does anyone know what I am doing wrong? It seems logical to access port 7999 on the proxy and and then forward to 8080.

Hey @MithilV, welcome to the Fastly community.

I’m wondering if this issue could be related to Docker networking rather than Pushpin itself. Based on your usage of host.docker.internal I assume you’re running on Docker Desktop (or colima), so could you try running the following command to verify the connection between the Docker container and your backend service?

docker run --rm alpine/curl http://0.0.0.0:8080/

Whether you get a connection error or HTTP response will indicate where the issue lies.

I’ll also tag @jkarneges who may be able to spot any problems with your Pushpin routes file.

0.0.0.0 is not a valid IP address in a URL. It is often the address used to setup a binding (where a service will listen) because it means ‘any address’, but you can’t use it to establish an outbound connection.

Your connection attempts will have to include the IP address where the daemon (or container mapping the daemon’s port) are actually listening.

1 Like

Using 0.0.0.0 was fine since I had my docker routes file mapping any route to host.docker.internal:8080. The problem here ended up being that I was executing keep alive logic at my origin server. This is not allowed since any keep alive logic should be automatically managed by pushpin. After removing the logic and setting the necessary Grip headers it all seemed to work. Thanks everyone!

1 Like

Random followup: I learned today (in a totally different place) that an attempt to make an outbound connection to 0.0.0.0 will work if the listening service is bound to 0.0.0.0 (makes sense) or to 127.0.0.1 (this blew my mind).