-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Feature req: HTTP -> HTTPS redirects (ALB-native) #487
Comments
Please someone do this 🎉 |
@bigkraig Are you planning to have this in v1.0? |
How would you all like to see this implemented? The ingress spec is somewhat limiting. |
Even I am looking for https redirection with alb-ingress.When are you guys planning to implement this feature?? |
@bigkraig I think it would make sense to have this as another ingress annotation? |
I think that would be the only way, but I hate to make people make more json encoded annotation strings. |
The ingress backend spec has I'm pretty sure service names can't include a Something like this
|
I think it's better to have a boolean annotation and redirect all HTTP requests to HTTPS requests by a listener creation to AWS. What do you think @bigkraig ? |
The redirect action is much more powerful than that and rather than providing two methods that would conflict, i'd prefer to let users leverage all of the action options in the same method. |
I agree with you about the reusable methods. If you can provide examples then I think it totally works. Anw, I think it's still best to extend the method and utilise what AWS offers. |
This is pretty big for us, what's the current workaround you've been using to enforce this? |
At least I'm using https proxy (a nginx app with redirect feature). How do you think if all the state of resources at AWS can be the super-set of what has been configured in the Ingress object? |
Using the
|
Yeah. I thought about this and it happened with validation. |
the hard part is figuring out a way to configure the actions without making a bunch of complicated annotations. i'll try to find some time to think about it today |
What does everyone think of this? My only concern here is if the service name The idea is that we can define actions using the
|
@bigkraig I think for the type |
@anhpham1509 the action looks like:
I think
|
Yeah. This sounds really good, IMO. |
It's probably a little more than half a day of work. I'd just need to parse the annotations into a new action type and then replace service backends with those actions, but i'm sure there will be some problems along the way. |
A bit longer than that, since the default backend stuff would also need it and it has different logic to deal with. |
Thinking about it, we should also have some kind of way to trigger the annotation usage, incase there are naming conflicts. So use
|
I'll probably reuse the SDKs types and support all configuration options in https://docs.aws.amazon.com/sdk-for-go/api/service/elbv2/#Action |
Sounds good with the use of servicePort. I’m thinking this would probably takes more than a day. Hope that you have time to implement this soon. |
@anhpham1509 I type fast. If anyone wants to try it out, see #542. Docs are in there and before I give some examples i'd prefer if people read the doc and make sure it is easy to understand, it's probably one of the more complicated annotations. The only thing left to do in #542 is to add support for the custom actions for the ingresses default backend. I'll probably tackle that next week sometime. |
@smaslennikov ah. im not familiar with the intricacies there. do you know for sure such a thing can be done with albs? @bigkraig
Note that with my slightly different config and use of latest this log does NOT have the null memory dereference error as shown in qgriffith-xylem |
@qgriffith-xylem ive found that you can pass in a port to the redirect action. this makes the redirect action work. However it still reports itself as failing in the log and goes into its backoff logic.
|
@bdirito |
Same here. I'm getting below with image |
Is it possible to re-open this issue? |
I'll try and take a look at this again today. I tested one of the configurations yesterday and I wasn't able to reproduce it. |
@bigkraig Please let me know if you need any information, happy to help. |
I saw there was a
Getting closer |
@qgriffith-xylem can you run with |
Sure thing, here is the output
|
@bigkraig Anything else I can do to help? This is the last thing on my list to get working before I can go live with k8s. So let me know what I can do to assist. Thanks. |
so the new |
Ok if I remove ``` Path is /
|
So I have it working with
I got one nil pointer it seemed to be because I didn't have enough spaces between backend: and serviceName on the new line. Once I fixed that and re-deployed all was well. Great work @bigkraig |
Is it OK to swtich to latest now or can you let us know when it is merged? @bigkraig |
@qgriffith-xylem it'll be merged soon but we are still a little bit away from the next beta release |
For reference, here is my working ingress object:
|
Guys, please add this as an example in the repository. This is something very common when using ALBs. |
@AndresPineros |
I understand this topic is marked as closed, but I was wondering if there is a way to stop I've tried doing this (I note a comment made), but does not appear to be valid syntax. Not at least from
Perhaps a URI feature can be added for config flexibility?
Screenshot from AWS console ALB Rules |
@stevenpall thanks for posting your working version! It helped me a ton in figuring this out. @M00nF1sh I think it would be huge help to add an example hostname ingress configuration to the documentation for those looking to configure ssl-redirects. The hostname configuration is more tricky than the path based configuration because with hostnames both the SSL redirect and the service want to use If you're into adding this to the docs, I can open a PR! |
new url: https://kubernetes-sigs.github.io/aws-load-balancer-controller/guide/tasks/ssl_redirect/ |
Unfortunately, loadbalancer which is created by this Ingress resource is not acceptable by AWS Security Hub. When I'm trying to apply ssl redirect to default rule (spec.backend), I'm getting following error in logs. @M00nF1sh
As far as I understand, the loop can appear because of applying the same default rule to both listeners 80 and 443. |
Right now, in order to redirect users to HTTPS, the application's backend had to serve the redirects since until now ALBs didn't support modifying requests. For comparison, the nginx ingress controller supports HTTP->HTTPS redirects from an annotation because nginx itself will happily redirect.
Today a new ALB feature was launched which lets the ALB itself redirect traffic. This could be used for a few different things, but the obvious primary use-case (and the one called out in the blog post) is HTTP->HTTPS redirects. So hopefully there's a potential clean way for alb-ingress-controller to offer this feature.
Feature announcement, supports redirects and static responses without hitting the backend: https://aws.amazon.com/about-aws/whats-new/2018/07/elastic-load-balancing-announces-support-for-redirects-and-fixed-responses-for-application-load-balancer/
Specific documentation for redirects: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html#redirect-actions
The text was updated successfully, but these errors were encountered: