Skip to content

Forward HTTP headers to /generate endpoint (Fixes #8790) - #8916

Open
92subrata wants to merge 5 commits into
triton-inference-server:mainfrom
92subrata:fix/generate-header-forward-8790
Open

Forward HTTP headers to /generate endpoint (Fixes #8790)#8916
92subrata wants to merge 5 commits into
triton-inference-server:mainfrom
92subrata:fix/generate-header-forward-8790

Conversation

@92subrata

@92subrata 92subrata commented Aug 3, 2026

Copy link
Copy Markdown

What

--http-header-forward-pattern forwarded matching HTTP headers to the
backend via request.parameters() on the /infer endpoint, but
HandleGenerate() never called ForwardHeaders(). As a result the flag
had no effect on the /generate endpoint (including the
ensemble → Python backend path) and headers were silently dropped.

Fix

Add the missing ForwardHeaders(req, irequest) call in
HandleGenerate(), matching the placement used by /infer, so header
forwarding behaves consistently across both endpoints.

Test

Adds test_http_header_forward_pattern_generate in qa/L0_parameters,
POSTing to /generate on both the parameter model and the ensemble
(identity → Python backend), asserting the forwarded headers come back
as request parameters. Wired into test.sh with
--http-header-forward-pattern MY_HEADER.*.

Existing test methods are untouched — the change is purely additive.

Fixes #8790

…rver#8790)

The --http-header-forward-pattern flag forwarded matching HTTP request
headers to the backend via request.parameters() for the /infer endpoint,
but HandleGenerate() never called ForwardHeaders(). As a result the flag
had no effect on the /generate endpoint (including the ensemble ->
Python backend path) and headers were silently dropped.

Add the missing ForwardHeaders(req, irequest) call in HandleGenerate(),
matching the placement used by /infer, so the same forwarding behavior
applies consistently across both endpoints.

Add a regression test (test_http_header_forward_pattern_generate) that
POSTs to /generate on both the 'parameter' model and the 'ensemble'
(identity -> Python backend) and verifies the forwarded headers are
echoed back as request parameters.

Fixes triton-inference-server#8790

Signed-off-by: 92subrata <subrata.sarkar@walmart.com>
@92subrata

92subrata commented Aug 3, 2026

Copy link
Copy Markdown
Author

Hi maintainers — this is a small, additive fix + regression test for #8790 (--http-header-forward-pattern was silently dropped on the /generate endpoint, including the ensemble → Python backend path). Existing tests are untouched. Would really appreciate a review whenever you have a moment. Happy to address any feedback. Thanks!

@greptile-apps

greptile-apps Bot commented Aug 3, 2026

Copy link
Copy Markdown

Greptile Summary

The PR makes configured HTTP header forwarding apply to the /generate endpoint and adds integration coverage for direct and ensemble-backed generation.

  • Calls ForwardHeaders while constructing generate inference requests.
  • Adds raw HTTP /generate checks for matching header names, values, and associations.
  • Runs the new regression test with --http-header-forward-pattern.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/http_server.cc Applies the existing configured header-forwarding behavior to generated inference requests before dispatch.
qa/L0_parameters/parameters_test.py Adds direct and ensemble /generate regression coverage and correctly verifies header-to-value associations.
qa/L0_parameters/test.sh Registers the new test and starts its server with the required HTTP header-forwarding pattern.

Reviews (5): Last reviewed commit: "Merge branch 'main' into fix/generate-he..." | Re-trigger Greptile

Comment thread qa/L0_parameters/parameters_test.py Outdated
Address review feedback on triton-inference-server#8916: comparing the key and value arrays as
independent sets did not verify their pairwise association, so a response
that mapped the right values to the wrong header names would still pass.

Reconstruct the mapping with dict(zip(key, value)) and compare it to the
expected headers so each forwarded header must keep its correct value.

Signed-off-by: 92subrata <subrata.sarkar@walmart.com>
@92subrata

Copy link
Copy Markdown
Author

@yinggeh @Vinya567 — could you please review this PR when you get a chance? Thanks!

@Vinya567

Copy link
Copy Markdown
Contributor

@yinggeh @Vinya567 — could you please review this PR when you get a chance? Thanks!

Hi @92subrata , thanks for the PR.

The change looks good: HandleGenerate was missing the ForwardHeaders call that /infer already has, and the L0_parameters regression covers the /generate path (including ensemble → Python).

One prerequisite : Triton requires all contributors (or their corporate entity) to have a signed Contributor License Agreement on file with triton-cla@nvidia.com.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] --http-header-forward-pattern has no effect on /generate endpoint (ensemble → Python backend)

2 participants