LXD Proxy Device: can't receive a response data

I have a host (10.21.45.160) and a lxc container (10.118.64.55). The container is running a NodeJS server at port 7001. On host console I can do the following with the correct response:

ubuntu@ubuntu-virtual-machine:~$ curl 10.118.64.55:7001/getProfiles
[“Pusher”,“admin”,“Fiscal de Sonda”,“Fiscal de Turno”,“Fiscal de SMS”]

I have to send http requests to the container, but I need to send such request by using host IP (10.21.45.160). It is just like a NAT from the host to the container, so in host I did:

lxc config device add tegra myport7001 proxy listen=tcp:0.0.0.0:7001 connect=tcp:127.0.0.1:7001

Now I can send http request, but it seams that the response is not coming back. On host console I receive the following:

ubuntu@ubuntu-virtual-machine:~$ curl 10.21.45.160:7001/getProfiles
curl: (52) Empty reply from server

Does any one has any tip of what might be going wrong?

Any error in that application’s log? The one different here I guess is that you’re hitting 127.0.0.1:70001 instead of 10.118.64.55:7001 so it could be that the application isn’t listening on localhost or is otherwise special casing it.

There no error in the application log, but I notice a strange behaviour. I sent two the curl command, in less than 1 second, and I received different

ubuntu@ubuntu-virtual-machine:~$ curl 10.21.45.160:7001/getProfiles
curl: (56) Recv failure: Connection reset by peer
ubuntu@ubuntu-virtual-machine:~$ curl 10.21.45.160:7001/getProfiles
curl: (52) Empty reply from server

I have successfully removed the device “myport7001” using:

lxc config device remove tegra myport7001

… and then I added the device again, but changing 127.0.0.1 for 10.118.64.55