'GKE GCE Ingress FrontendConfig redirect non-www to www

I want to redirect all non-www traffic to www traffic. E.g. mydomain.com to www.mydomain.com

GKE Ingress (GCE) uses Frontendconfig. Is there a way to configure FrontendConfig to redirect non-www traffic to www traffic.

Followed this guide (https://cloud.google.com/kubernetes-engine/docs/how-to/ingress-features) to create FrontendConfig. In that guide there is no mention of such feature.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source