[Part 1] How to configure URL redirection with GCP's global external HTTP(S) load balancer (traditional)
Hello!
My name is Hide, the ramen king of Beyond Osaka Office.
This is my 8th post.
Last time, I wrote about how to install a free SSL certificate with GCP's Google Cloud Load Balancing (GCLB)!
In my blog post, I wrote an interesting article about installing a free SSL certificate that you may not know about, so if you are interested, please take a look!
● How to install a free SSL certificate on GCP load balancer (GCLB)
How to install a free SSL certificate on GCP load balancer (GCLB)
About Google Cloud Load Balancing (GCLB) URL redirects
URL redirection means that when you access one URL, you are automatically redirected to another URL, just like when you access example.com, you are automatically redirected to example2.com. Most can be configured with Apache, Nginx, etc. on the web server.
In that case, the access goes directly to the web server, which may increase the load on the server, but if there is a load balancer (LB) in front of the server, URL redirect settings can be done with the LB alone. You can reduce the load on Apache, Nginx, etc. on your web server.
URL redirect settings are also possible with Google Cloud Load Balancing (GCLB), but the URL redirect settings are different for "Global HTTP(S) Load Balancer" and "Global External HTTP(S) Load Balancer (Conventional)". it's different. The traditional type is easier to set up than the global HTTP(S) load balancer.
It is very difficult to set up by just looking at the documentation, but if you look at this blog, you can easily set up URL redirection, so let's set it up together!
Setting procedure
*This assumes that a load balancer (LB) has been created.
① Load balancing > LB name > Click Edit
② Select detailed host and path rules and click [Add host and path rules]
③ Specify the redirect source domain with new host and path rules
④Click [Add path rule]
⑤ Configure redirect settings
● Path: Specify the path to be redirected
● Action: Redirect the client to another host/path
● Redirect host: Specify the redirect destination
● Redirect path: Please select the appropriate one
● Redirect response code 301
● HTTPS redirect: Please select the appropriate one
● Delete query: Please select the appropriate one
*Reference material: URL redirect setting official document
⑥ Operation confirmation
*Please do this after the LB update is complete
*Please check if you are redirected
↓
summary
What do you think?
Traditional global HTTP(S) load balancers are easy to set up redirects, so I think I was able to set up redirects with GCLB right away.
However, if you can properly set up redirects with a load balancer, you can do it without putting any load on the server, so we recommend it!
If you want to set up a redirect with GCP's LB, please use this as a reference!