Reverse proxy to same machine but different port
Added by wbramw about 5 years ago
I have a device running Buildroot, with Lighttpd 1.4.48 installed on it.
Lighttpd is configured to use the default port 80.
On the same device, there is a Pistache server that is hosting a REST api on port 9111.
Ideally I want to access this REST api on port 80. In the future, there will be more than one REST api (on different ports) and I want everything accessible on the same port, without the client being aware of this.
Mod_proxy seems to allow this, however I have not succeeded in doing this.
Right now, the configuration of mod_proxy is fairly simple. I just proxy every incoming request to port 9111, for testing purposes.
Now if I use Google Chrome to access the REST api on port 9111 (so without using Lighttpd), everything works fine. I get the expected response fast (< 1 second).
However if I try to do the same request on port 80 (which Lighttpd should transfer to port 9111), the request is pending. Forever. I never get the value that I expect to receive.
In the logs of Lighttpd, I saw this interesting line:
‘connect delayed; will continue later: tcp:127.0.0.1:9111’
Unfortunately I haven’t found any information which can help me further with this issue. I’m hoping that there is anyone here that can help me. I appreciate every input very much.
Thanks!
lighttpd_proxy_config.png (9.18 KB) lighttpd_proxy_config.png | |||
swagger_9111.png (154 KB) swagger_9111.png | |||
swagger_80.png (64.7 KB) swagger_80.png | |||
lighttpd_logging.png (139 KB) lighttpd_logging.png |
Replies (2)
RE: Reverse proxy to same machine but different port - Added by gstrauss about 5 years ago
Check the Pistache config. Is it listening for requests on 127.0.0.1? Test having lighttpd mod_proxy config use 192.168.0.135 instead of 127.0.0.1
Use strace
on lighttpd pid and on Pistache pid. Does Pistache accept a connection? Does it receive the request from lighttpd?
Take a look at the request received by lighttpd. Is the request a complete HTTP/1.1 request and compliant?debug.log-request-header = "enable"
You might also change lighttpd streaming from fully buffered to streaming:server.stream-request-body = 1
(documentation: Server_stream-request-bodyDetails)server.stream-response-body = 1
(documentation: Server_stream-response-bodyDetails)
RE: Reverse proxy to same machine but different port - Added by gstrauss about 5 years ago
Also, lighttpd 1.4.48 was released over a year ago. Latest lighttpd is lighttpd 1.4.53. Please test with the latest lighttpd release.