0

I have configured lighttpd 1.4.48 to proxy my /api endpoints received on port 80 to a local API server running on port 8080 as shown below:

# Forward all /api requests to the apiserver
$HTTP["url"] =~ "^/api" {
  proxy.server = (
    "/api" => (
      (
        "host" => "127.0.0.1",
        "port" => "8080" 
      )
    )
  )
}

There is a web app that polls the same API endpoint (/api/status/dashboard) every 5 seconds. The issue I am seeing is that the first time, it takes about 600ms to return to the browser. The second time 1.5s. Then 2.7s, then 3.5s, then 4.7s, then 6.1s, then back to about 600ms. This cycle repeats over and over. Essentially, each request takes an extra ~1.1s until it goes over 5 seconds, then it resets.

From the logging on my API server, I can see that the request is not received immediately. For some reason it is not being immediately forwarded by lighttpd.

In addition, if I send the request from Postman directly to port 8080, there is no delay, but sending through port 80, has the delay described above.

I found some info on lighttpd proxy delays that suggested using the following config:

server.stream-request-body = 1
server.stream-response-body = 1

With the above values set to 0 (or don't include these lines), then every request is consistently delayed by 5 seconds. With them set to 1 or 2, I get the same increasing/cycling delays described above.

Does this seem like a misconfiguration on my part or possibly a bug?

Does anyone else have a proxy/forwarding setup that works properly and could share their config?

Any help would be most appreciated!

Thanks!

p.s. Also asked on the lighttpd site:

https://redmine.lighttpd.net/issues/2907?issue_count=17&issue_position=1&next_issue_id=2905

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.