Home
Help
Search
Login
Register
OPNsense Forum
»
English Forums
»
Web Proxy Filtering and Caching
(Moderator:
fabian
) »
HAProxy: How to use "Connection: keep-alive"?
« previous
next »
Print
Pages: [
1
]
Author
Topic: HAProxy: How to use "Connection: keep-alive"? (Read 1317 times)
syndac
Newbie
Posts: 6
Karma: 0
HAProxy: How to use "Connection: keep-alive"?
«
on:
June 13, 2024, 06:38:27 am »
I have an app that uses server sent events with the headers, "Connection: keep-alive" and "Keep-Alive: timeout=60". When I test my app locally, I can tell everything works fine and I can see that the connection stays alive and the response headers in Chrome dev tools show both of those headers.
However, when I deploy my app to my server and access via HAProxy, I can see that the connection immediately closes and the response headers are missing.
What settings in HAProxy control this? Nothing really stands out, though I'm not an expert.
Logged
syndac
Newbie
Posts: 6
Karma: 0
Re: HAProxy: How to use "Connection: keep-alive"?
«
Reply #1 on:
June 17, 2024, 11:57:36 pm »
Got it. There's a couple things I had to do:
1. Disable HTTP/2 on the frontend Public Service. I'm not sure why. Connection: keep-alive uses HTTP/1.1 and having HTTP/2 available seems to confuse it
2. To the backend, add the following under Options pass-through:
option http-server-close
http-request set-header Connection keep-alive
http-request set-header Keep-Alive timeout=600
Logged
syndac
Newbie
Posts: 6
Karma: 0
Re: HAProxy: How to use "Connection: keep-alive"?
«
Reply #2 on:
June 18, 2024, 06:59:44 pm »
Actually, scratch that (above). Options pass-through on the backend doesn't seem to work. Not sure why. On the "Public interface", I had to add this to the options:
http-request set-header Connection keep-alive if acl_<acl fround in config export>
http-request set-header Keep-Alive timeout=600 if acl_<acl fround in config export>
Logged
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
English Forums
»
Web Proxy Filtering and Caching
(Moderator:
fabian
) »
HAProxy: How to use "Connection: keep-alive"?