New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add support for HTTP keep-alive between the proxy and upstream #1934
Conversation
I'm not super satisfied with the tests I added, but I couldn't think of a good way to thoroughly test the feature (e.g., grepping the generated config file seems too fragile). |
Friendly ping @buchdag |
df14ef3
to
fd8b8cb
Compare
Marking as draft until #2127 is merged. |
6f77539
to
1eede4a
Compare
7bcc530
to
d0e8306
Compare
@rhansen I've got mixed feeling about the use of labels. While I too do prefer labels to environment variables (as they inherently avoid stuff like #2139), I think we should stick to environment variables unless we're prepared to migrate everything to labels, as we don't use labels for anything yet. I also believe that people are more familiar with environment variables than they are with labels. Other than that, LGTM ✅ |
Good points. However, assuming we will eventually migrate the existing environment variables to labels (I think we should; they are designed for this purpose), using an environment variable for this feature makes more work for us now and later. I'd rather live with the short-term inconsistency. |
@rhansen the way I see it, in the end we should keep environment variables for configuration of the nginx-proxy (or docker-gen) container, and switch to labels on the proxied containers. Do you agree with this ? |
@rhansen I'll review this again tonight or tomorrow but it should be okay to merge before next release. |
@rhansen I did not notice the experimental status of the feature. What would be needed to confirm that it work as intended ? |
Time, or discussions/bug reports. We don't have a way of collecting usage statistics, so there's not much we can do other than eventually think to ourselves, "this feature has been around for a while and nobody has complained, so it's probably OK." Mostly I'm concerned with the user interface, not the concept or implementation. I don't want to be stuck preserving backwards compatibility for a fundamentally flawed interface. |
keepalive is not experimental and is even recommended to have enabled. I do like the way of this implementation by @rhansen (also I like the docker label concept) |
Agreed; the experimental thing here is the ability to enable keepalive in
Thanks for the feedback! |
I suspect there is a problem setting the According to the manpage: Allows redefining or appending fields to the request header passed to the proxied server. The value can contain text, variables, and their combinations. These directives are inherited from the previous configuration level if and only if there are no proxy_set_header directives defined on the current level. So setting this single header in the current (location) level will cancel the inherited directives inherited from the global level:
I tried to test this PR but as side effect it closed all my websocket upgrades. And also the x-real-ip was missing.
|
5bdfeb6
to
5fbc45b
Compare
Good catch, thank you @SchoNie!
Thanks for the suggestion. I went with a different approach that preserves per-upstream configurability (it can be turned on for some containers and left off for others). I also updated the tests to check for the regression you found. If you have the time, I would appreciate it if you looked at the new revision. |
Tested, LGTM. |
Fixes #609
Note: This depends on PR #2127, and will be marked as draft until that PR is merged.