-
Notifications
You must be signed in to change notification settings - Fork 133
OCPBUGS-65482: Fix HAProxy redirect: strip port from Host header #696
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
OCPBUGS-65482: Fix HAProxy redirect: strip port from Host header #696
Conversation
|
@bentito: This pull request references Jira Issue OCPBUGS-65482, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/jira refresh |
|
@bentito: This pull request references Jira Issue OCPBUGS-65482, which is invalid:
Comment DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/jira refresh |
|
@bentito: This pull request references Jira Issue OCPBUGS-65482, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
Requesting review from QA contact: DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
reproduced it with 4.21.0-0.nightly-2025-11-22-193140 and verified it with 4.21.0-0-2025-12-02-060314-test-ci-ln-sikxch2-latest Reproduced: Verified: |
|
/label qe-approved |
|
@bentito: This pull request references Jira Issue OCPBUGS-65482, which is valid. 3 validation(s) were run on this bug
Requesting review from QA contact: DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@ShudiLi: This PR has been marked as verified by DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
alebedev87
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First glance.
|
/assign |
|
As discussed in Slack, we would need an e2e test for this change. Unfortunately it can't be done in this repository as we host them in |
|
/assign @Thealisyed |
|
Tested it again and saw the 302 redirect message |
|
tested it with 4.22.0-0-2026-01-07-063944-test-ci-ln-zm9prst-latest |
|
/verified by @ShudiLi |
|
@ShudiLi: This PR has been marked as verified by DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/test okd-scos-images |
…strings Modified HAProxy configuration template to strip the port from the Host header during HTTPS redirection and ensure query strings are preserved. Added a test case to verify the correct redirection logic.
340ce0f to
823a6fd
Compare
|
/lgtm |
|
/verified by @ShudiLi Just a squash of commits, retagging.. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alebedev87 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@alebedev87: This PR has been marked as verified by DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@bentito: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
@bentito: Jira Issue OCPBUGS-65482: Some pull requests linked via external trackers have merged: The following pull request, linked via external tracker, has not merged: All associated pull requests must be merged or unlinked from the Jira bug in order for it to move to the next state. Once unlinked, request a bug refresh with Jira Issue OCPBUGS-65482 has not been moved to the MODIFIED state. This PR is marked as verified. If the remaining PRs listed above are marked as verified before merging, the issue will automatically be moved to VERIFIED after all of the changes from the PRs are available in an accepted nightly payload. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
Previously, when a route was configured with insecureEdgeTerminationPolicy: Redirect, HAProxy would preserve the port from the Host header in the redirect Location. This caused clients to attempt HTTPS connections on port 80 (e.g., https://example.com:80) if the original request included the port.
This commit updates the HAProxy template to explicitly strip any port number from the Host header using 'regsub(:[0-9]+$,,)' before constructing the redirect URL. This ensures redirects always go to the default HTTPS port (443).
A regression test 'Secure Redirect Strips Port' has been added to pkg/router/router_test.go to verify this configuration generation.