Skip to content
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

"request-redirect" annotation always redirects to http #613

Open
fgmpe opened this issue Feb 13, 2024 · 2 comments
Open

"request-redirect" annotation always redirects to http #613

fgmpe opened this issue Feb 13, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@fgmpe
Copy link

fgmpe commented Feb 13, 2024

I have Ingress with request-redirect annotation:

## ...
annotations:
    haproxy.org/request-redirect: www.example.org
spec:
  rules:
    - host: example.com
## ...

When I send request for https://example.org, I expect response with header Location: https://www.example.org, but in reality I get Location: http://www.example.org

HAProxy configuration line is always rendered with hardcoded http protocol.

frontend https
  ## ...
  http-request redirect location http://www.example.org%[capture.req.uri] code 302 if { var(txn.path_match) -m dom 000.... } 
  ## ...

It would be great if this could be customized with new annotation the same way as request-redirect-code allows to customize the redirect code, or directly in existing annotation value:

annotations:
   ## proposal 1 - new annotation for protocol override
    haproxy.org/request-redirect-protocol: https

   ## proposal 2 - existing annotation with optional protocol
    haproxy.org/request-redirect: https://www.example.org
@fgmpe
Copy link
Author

fgmpe commented Feb 13, 2024

It looks like it's already prepared here. But I can't see how to set the value of r.SSLRequest with Ingress annotation.

@ivanmatmati
Copy link
Collaborator

Hi @fgmpe , Your second idea seems to be the best as it's more direct. I'll check if the team is ok with that.

@ivanmatmati ivanmatmati added the enhancement New feature or request label Feb 19, 2024
@ivanmatmati ivanmatmati self-assigned this Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants