<p>I'm using Google Cloud Load Balancer as the ingress controller to my GCP Kubernetes application.  I want all requests to <code>www.my_domain.com</code> to be redirected to <code>my_domain_.com</code>.  </p>

<p>Note: My GCLB is configured with an SSL certificate that is valid for both <code>www.my_domain.com</code> and <code>my_domain.com</code>.</p>

<p>I know this is possible using an http redirect in my external DNS management console, but an issue arises because of SSL termination. </p>

<ol>
<li><p>I create an http redirect rule in my DNS management console to route all <code>www.my_domain.com</code> traffic to <code>https://my_domain.com</code>.  </p></li>
<li><p>If a client browses to domain <code>https://www.my_domain.com</code>, they will get a browser warning because the request will first go to server of my DNS management tool, which is not configured with a matching SSL cert.</p></li>
</ol>

<p>I know that GCLB has limitations for redirecting http traffic to https, but that's not my main concern here.  What I want to know is if it's possible in GCLB to configure a routing rule so that any request for <code>www.my_domain.com</code> is redirected to <code>my_domain.com</code>.</p>

<p>Thanks for any help!</p>

Murcielago
<p>Redirect rules are supported when you switch your &quot;Host and path rules&quot; from the &quot;Simple host and path rule&quot; to the &quot;Advanced host and path rule&quot; option now. This advanced option allows for URL redirect and URL rewrite.</p>
<p>Edit your Load Balancer, go to &quot;Host and path rules&quot;, click &quot;Add host and path rule&quot;.</p>
<p>Host: <code>www.my_domain.com</code></p>
<p>Path: <code>/*</code></p>
<p>Action: <code>Redirect the client to different host/path</code> and specify your host <code>my_domain.com</code></p>
<p>Path redirect: <code>Full path redirect</code></p>
<p>Redirect response code: <code>301</code></p>
<p>HTTPS redirect: <code>Enable</code></p>
<p>Check this Google Cloud page (no screenshots unfortunately) here <a href="https://cloud.google.com/load-balancing/docs/https/setting-up-url-redirects-classic" rel="nofollow noreferrer">https://cloud.google.com/load-balancing/docs/https/setting-up-url-redirects-classic</a></p>
