Skip to content

Conversation

@aletourneau
Copy link

@aletourneau aletourneau commented Oct 31, 2025

Corresponds to: fluent/fluent-bit#11080

Summary by CodeRabbit

  • New Features

    • Added add_remote_addr option to the HTTP input (default: false) to populate a REMOTE_ADDR field from X-Forwarded-For, with handling for single vs. multiple headers and HTTP/2 semantics.
  • Documentation

    • Updated HTTP input docs with configuration guidance, YAML/conf examples, and curl test commands demonstrating add_remote_addr behavior across different X-Forwarded-For scenarios.

✏️ Tip: You can customize this high-level summary in your review settings.

Copy link
Contributor

@esmerel esmerel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My suggestions are stylistic for page consistency. They're fairly minor. This looks good to me otherwise, but should have a technical review for final approval.

@aletourneau aletourneau force-pushed the in_http/add_remote_addr branch from bc93bab to 867a1fb Compare November 3, 2025 21:07
@eschabell eschabell added the waiting-on-review Waiting on a review from mainteners label Nov 4, 2025
@eschabell eschabell self-assigned this Nov 4, 2025
Copy link
Contributor

@patrick-stephens patrick-stephens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems ok, waiting on code merge.

@patrick-stephens patrick-stephens removed the waiting-on-review Waiting on a review from mainteners label Nov 5, 2025
@eschabell eschabell added 4.2.1 conflict Waiting on conflict to be resolved by contributor and removed 4.2.1 labels Dec 3, 2025
@lecaros
Copy link
Contributor

lecaros commented Dec 18, 2025

hi @aletourneau we're ready to merge the code PR and this one. Thanks for your contribution!
Could you please resolve the conflict?

@aletourneau
Copy link
Author

hi @aletourneau we're ready to merge the code PR and this one. Thanks for your contribution! Could you please resolve the conflict?

Yes, wasn't aware there was a conflict, I'll take a look, thank you for notifying me.

@aletourneau aletourneau force-pushed the in_http/add_remote_addr branch from 867a1fb to 17cb08f Compare December 18, 2025 18:58
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 18, 2025

Walkthrough

Adds a new add_remote_addr (default: false) configuration option to the HTTP input docs, describing how REMOTE_ADDR is derived from X-Forwarded-For (handling of single vs. multiple headers and HTTP/2), and adds example fluent-bit.yaml / fluent-bit.conf snippets plus curl tests.

Changes

Cohort / File(s) Summary
HTTP Input Documentation
pipeline/inputs/http.md
Adds add_remote_addr config (default: false); documents selection from single vs. multiple X-Forwarded-For headers and HTTP/2 behavior; inserts YAML and conf examples showing add_remote_addr, includes curl examples demonstrating behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested labels

4.2.1

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'in_http: add_remote_addr' clearly and specifically describes the main change: adding a new add_remote_addr configuration option to the HTTP input plugin.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5b47a8a and 897138d.

📒 Files selected for processing (1)
  • pipeline/inputs/http.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • pipeline/inputs/http.md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@aletourneau
Copy link
Author

@lecaros The conflict is now resolved.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4e21b77 and 17cb08f.

📒 Files selected for processing (1)
  • pipeline/inputs/http.md (3 hunks)
🔇 Additional comments (3)
pipeline/inputs/http.md (3)

8-19: Configuration table looks good.

The addition of add_remote_addr to the configuration parameters table is well-documented with a clear description and correct default value.


45-70: Documentation of add_remote_addr feature is clear and well-structured.

The explanation effectively covers the single header case and demonstrates the behavior with multiple X-Forwarded-For headers, showing how the http2 config affects which value is used. The table comparing http2 config values to the resulting REMOTE_ADDR value is helpful.


191-230: Configuration examples and curl test command are helpful.

The YAML and CONF format examples (aside from the capitalization issue flagged separately) and the curl test command provide good practical guidance for users wanting to enable this feature.

Once you fix the CONF format capitalization issue on lines 212–217, please verify that the examples work end-to-end with the corresponding code changes in the fluent-bit repository PR.

@aletourneau aletourneau force-pushed the in_http/add_remote_addr branch from 17cb08f to 55e9682 Compare December 18, 2025 19:11
@aletourneau
Copy link
Author

Note: addressed the capitalization concern raised by coderabbitai

Copy link
Contributor

@esmerel esmerel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some minor stylistic suggestions to reduce vale complaints.

curl -d '{"key1":"value1","key2":"value2"}' -XPOST -H "content-type: application/json" http://localhost:8888/app.log
```

### Add remote addr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Add remote addr
### Add a remote address

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not entirely sure about this one, because the header/section is aiming at documenting a configuration parameter called "add_remote_addr", so changing it to "add a remote address", might confuse the users... thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe ### Use add_remote_addr ? - that'd keep the info while getting rid of the vale complaint

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went with your initial suggestion, and also changed configuration option to configuration parameter to be more consistent across the board.

cf:

-### Add remote addr
+### Add a remote address field
 
-The `add_remote_addr` configuration option, when activated, adds a `REMOTE_ADDR` field to the records. The value of `REMOTE_ADDR` is the client's address, which is extracted from the `X-Forwarded-For` header.
+The `add_remote_addr` configuration parameter, when activated, adds a `REMOTE_ADDR` field to the records. The value of `REMOTE_ADDR` is the client's address, which is extracted from the `X-Forwarded-For` header.

curl -d '{"key1":"value1"}' -XPOST -H 'Content-Type: application/json' -H 'X-Forwarded-For: host1, host2' http://localhost:8888
```

However, if your system sets multiple `X-Forwarded-For` headers in the request, the one used (first, or last) depends on the value of the `http2` config. For example:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
However, if your system sets multiple `X-Forwarded-For` headers in the request, the one used (first, or last) depends on the value of the `http2` config. For example:
However, if your system sets multiple `X-Forwarded-For` headers in the request, the one used (first, or last) depends on the value of the `http2` configuration. For example:

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix that.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed config to parameter since http2 is a parameter of the in_http plugin. I feel this is even more specific.


The value of REMOTE_ADDR will be:

| http2 config | value of REMOTE_ADDR |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| http2 config | value of REMOTE_ADDR |
| HTTP/2 config | Value of `REMOTE_ADDR` |

http/2 is still going to throw a spelling error, but it appears to be the proper noun version of the product name.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The configuration option is actually called http2 (cf: line 13) so, from my point of view this should not be changed.

Copy link
Author

@aletourneau aletourneau Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: the config there, could be changed to configuration though, so at least that wouldn't register as a warning.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed http2 config to http2 parameter and added back ticks around REMOTE_ADDR

@aletourneau aletourneau force-pushed the in_http/add_remote_addr branch from 55e9682 to 5b47a8a Compare December 22, 2025 19:08
Signed-off-by: Alexandre Létourneau <letourneau.alexandre@gmail.com>
@aletourneau aletourneau force-pushed the in_http/add_remote_addr branch from 5b47a8a to 897138d Compare December 22, 2025 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflict Waiting on conflict to be resolved by contributor waiting-on-code-merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants