Skip to content

[FLINK-39365][connector-http] Support custom HTTP headers via ConfigOption#32

Open
featzhang wants to merge 3 commits into
apache:mainfrom
featzhang:feature/support-custom-http-headers
Open

[FLINK-39365][connector-http] Support custom HTTP headers via ConfigOption#32
featzhang wants to merge 3 commits into
apache:mainfrom
featzhang:feature/support-custom-http-headers

Conversation

@featzhang
Copy link
Copy Markdown
Member

Add formal ConfigOption definitions for custom HTTP headers in both the HTTP lookup source and HTTP dynamic sink connectors.

Previously, custom HTTP headers were only configurable via raw properties using the prefixes 'http.source.lookup.header.' and 'http.sink.header.', but these were not declared as official ConfigOptions. This meant no IDE autocomplete support, missing documentation, and unclear user guidance.

Changes:

  • Add SOURCE_LOOKUP_HEADERS ConfigOption (Map type) to HttpLookupConnectorOptions with prefix 'http.source.lookup.header'
  • Add SINK_HEADERS ConfigOption (Map type) to HttpDynamicSinkConnectorOptions with prefix 'http.sink.header'
  • Register both options in the respective factory's optionalOptions() so Flink's table option validator recognizes them
  • Add tests verifying custom headers can be specified in SQL DDL without triggering ValidationException

The header values are still passed through Properties and read by the existing HttpHeaderUtils.prepareHeaderMap() mechanism, so the runtime behavior is unchanged. The new ConfigOptions serve primarily as documentation and validation anchors.

@featzhang featzhang changed the title [connector-http] 支持自定义 HTTP headers via ConfigOption [FLINK-39365][connector-http] Support custom HTTP headers via ConfigOption Mar 31, 2026
Add formal ConfigOption definitions for custom HTTP headers in both
the HTTP lookup source and HTTP dynamic sink connectors.

Previously, custom HTTP headers were only configurable via raw properties
using the prefixes 'http.source.lookup.header.' and 'http.sink.header.',
but these were not declared as official ConfigOptions. This meant no IDE
autocomplete support, missing documentation, and unclear user guidance.

Changes:
- Add SOURCE_LOOKUP_HEADERS ConfigOption (Map type) to
  HttpLookupConnectorOptions with prefix 'http.source.lookup.header'
- Add SINK_HEADERS ConfigOption (Map type) to
  HttpDynamicSinkConnectorOptions with prefix 'http.sink.header'
- Register both options in the respective factory's optionalOptions()
  so Flink's table option validator recognizes them
- Add tests verifying custom headers can be specified in SQL DDL
  without triggering ValidationException

The header values are still passed through Properties and read by the
existing HttpHeaderUtils.prepareHeaderMap() mechanism, so the runtime
behavior is unchanged. The new ConfigOptions serve primarily as
documentation and validation anchors.
@featzhang featzhang force-pushed the feature/support-custom-http-headers branch from a0c386d to 82c0e31 Compare March 31, 2026 09:14
Add documentation for the formal ConfigOption support of custom HTTP headers
(http.source.lookup.header.* and http.sink.header.*) introduced in FLINK-HTTP-3.

Changes:
- Add http.source.lookup.header.* entry to Lookup Source Connector Options table
- Update Http headers section for Lookup Source to note formal ConfigOption support
- Add http.sink.header.* entry to Sink Connector Options table
- Add new 'Sink Http headers' section with SQL DDL example
- Update TOC to include new Sink Http headers section
- Apply same changes to both English and Chinese documentation
@featzhang featzhang force-pushed the feature/support-custom-http-headers branch from 82c0e31 to d9412eb Compare March 31, 2026 09:22
- Update all DDL examples in documentation to use 'connector' = 'http-async-sink'
- Update Sink Connector Options table descriptions in table and datastream docs
- Update JavaDoc examples in HttpPostRequestCallbackFactory and HttpDynamicSink
- Aligns documentation with the factory identifier in HttpDynamicTableSinkFactory
Comment thread docs/content.zh/docs/connectors/datastream/http.md
'url' = 'http://example.com/myendpoint',
'format' = 'json',
'http.sink.header.Content-Type' = 'application/json',
'http.sink.header.Authorization' = 'Bearer my-token',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

fyi there is OIDC support for lookup joins - which uses bearer tokens under the covers. This is another candidate to be implemented for sinks.

featzhang added a commit to featzhang/flink-connector-http that referenced this pull request Apr 22, 2026
…ders

Address review feedback from davidradl on PR apache#32:
- Emphasize new ConfigOption approach as recommended method
- Clarify there is no precedence/conflict between header configurations
- Improve documentation structure with clearer benefits
- Update reference from [FLINK-HTTP-3] to [FLINK-39365]

The changes make it clear that:
1. The ConfigOption approach is the recommended way to configure headers
2. It provides validation, IDE support, and better discoverability
3. All headers use the same prefix pattern with no precedence issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants