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

Support http to https redirection based on $http_x_forwarded_proto #115

Closed
cwhenderson20 opened this issue Feb 11, 2017 · 5 comments
Closed

Comments

@cwhenderson20
Copy link

I am using this ingress controller behind an ELB on AWS and have configured the ELB to do all of the SSL termination. However, since I also want to accept standard HTTP requests, I've opened port 80 on the ELB as well.

This works great except for one detail: I'd like all connections to be over HTTPS and thus need to be able to define (for each ingress resource) a 301 redirect to HTTPS if the request is sent over HTTP.

Looking through the code, I can see that this is the default behavior if SSL termination is configured on the ingress controller itself, but given that my ELB is doing the SSL termination, the connection from the ELB to the ingress controller is always HTTP-only.

Would it be an easy addition to add an annotation/ConfigMap key that would allow this behavior? Something like: nginx.org/redirect-to-https that would enable a rule in the conf file such as:

if ($http_x_forwarded_proto = 'http') {
    return 301 https://$host$request_uri;
}

...or would this conflict with other configuration options? If this type of behavior is already possible using another combination of annotations or ConfigMap settings, please let me know.

@pleshakov
Copy link
Contributor

@cwhenderson20 that sounds good. This behavior is not possible with the existing ConfigMaps settings.

@cwhenderson20
Copy link
Author

@pleshakov, great! I'm not familiar with Go, but it looks like the addition should be relatively easy. Should I try to open a PR for this or are you already working on it?

@pleshakov
Copy link
Contributor

@cwhenderson20 yes, this can be done relatively easy. For example, this feature is similar -- https://github.com/nginxinc/kubernetes-ingress/pull/108/files -- has a boolean configmap/annotation. It'd be great if you could open a PR.

@cwhenderson20
Copy link
Author

Great, I'll try to get it to you this afternoon

@cwhenderson20
Copy link
Author

cwhenderson20 commented Feb 13, 2017

@pleshakov Opened PR #116

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

No branches or pull requests

2 participants