[Osaka/Yokohama] Looking for infrastructure/server side engineers!

[Osaka/Yokohama] Looking for infrastructure/server side engineers!

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Successor to CentOS] AlmaLinux OS server construction/migration service

[Successor to CentOS] AlmaLinux OS server construction/migration service

[For WordPress only] Cloud server “Web Speed”

[For WordPress only] Cloud server “Web Speed”

[Cheap] Website security automatic diagnosis “Quick Scanner”

[Cheap] Website security automatic diagnosis “Quick Scanner”

[Reservation system development] EDISONE customization development service

[Reservation system development] EDISONE customization development service

[Registration of 100 URLs is 0 yen] Website monitoring service “Appmill”

[Registration of 100 URLs is 0 yen] Website monitoring service “Appmill”

[Compatible with over 200 countries] Global eSIM “Beyond SIM”

[Compatible with over 200 countries] Global eSIM “Beyond SIM”

[If you are traveling, business trip, or stationed in China] Chinese SIM service “Choco SIM”

[If you are traveling, business trip, or stationed in China] Chinese SIM service “Choco SIM”

[Global exclusive service] Beyond's MSP in North America and China

[Global exclusive service] Beyond's MSP in North America and China

[YouTube] Beyond official channel “Biyomaru Channel”

[YouTube] Beyond official channel “Biyomaru Channel”

【Part1】GCP のグローバル外部 HTTP(S) ロードバランサ(従来型)で、URLリダイレクト設定する方法


*フラン軒 (本町)

こんにちは!
株式会社ビヨンド大阪オフィスのラーメン王、ヒデです。
今回が8回目の投稿です。

前回は GCP の Google Cloud Load Balancing(GCLB)で、無料のSSL証明書を設置する方法ついて書きました!
ブログ記事では、意外に知らない無料のSSL証明書を設置する面白い記事を書いたので、興味ある方は、ぜひ見てくださいね!

GCP のロードバランサー(GCLB)で無料のSSL証明書を設置する方法

GCP のロードバランサー(GCLB)で無料のSSL証明書を設置する方法

Google Cloud Load Balancing(GCLB)のURLリダイレクトについて

URLリダイレクトは、example.com にアクセスしたら、自動的に example2.com に転送される様に、あるURLにアクセスした際に、自動的に別のURLに対して転送されることを意味します。ほとんどはWebサーバーにある Apache や Nginx などで設定できます。

その場合は、アクセスが直接Webサーバーに向かうので、サーバーの負荷は上がる可能性がありますが、サーバーより前段にあるロードバランサ(LB)があれば、URLリダイレクト設定をLB単体で行うことができ、Webサーバーにある Apache や Nginx などの負荷を下げることができます。

Google Cloud Load Balancing(GCLB)でも同じようにURLリダイレクト設定は可能ですが、「グローバル HTTP(S) ロードバランサ」と「グローバル外部 HTTP(S) ロードバランサ(従来)」では、URLリダイレクトの設定方法が異なります。従来型は、グローバル HTTP(S) ロードバランサに比べて簡単に設定ができます。

ドキュメントだけ見て設定することは非常に難しいですが、このブログを見れば、簡単にURLリダイレクト設定ができますので、一緒に設定していきましょう!

設定手順

*ロードバランサ(LB)は作成している前提で行います。

① ロードバランシング > LB名 > 編集をクリック

 

② 詳細なホストとパスのルールを選択して【ホストとパスのルールを追加】をクリック

 

③ 新しいホストとパスのルールでリダイレクト元のドメインを指定する

 

④【パスのルールを追加】をクリック

 

⑤ リダイレクト設定を行う

● パス:リダイレクトされる時のパスを指定
● アクション:クライアントを別のホスト / パスにリダイレクト
● ホストのリダイレクト:リダイレクト先の指定
● パスのリダイレクト:適当なものをお選びください
● リダイレクトのレスポンスコード 301
● HTTPS リダイレクト:適当なものをお選びください
● クエリの削除:適当なものをお選びください

*参考資料:URLリダイレクト設定公式ドキュメント

 

⑥ 動作確認

*LBの更新が終わってから行ってください
*リダイレクトされるか確認してください

 

 

まとめ

いかがでしたでしょうか?

従来型のグローバル HTTP(S) ロードバランサはリダイレクト設定しやすいので、すぐに GCLB でリダイレクト設定ができたと思います。

でも、しっかりロードバランサでリダイレクト設定ができれば、サーバーでリダイレクト設定をせずとも、負荷をかけないでリダイレクトができるのでおすすめです!

GCPのLBでリダイレクト設定をする場合は、ぜひ参考にしてみてくださいね!

この記事がお役に立てば【 いいね 】のご協力をお願いいたします!
2
読み込み中...
2 票, 平均: 1.00 / 12
1,649
X facebook はてなブックマーク pocket
[2024.6.30 CentOS support ended] CentOS server migration solution

[2024.6.30 CentOS support ended] CentOS server migration solution

[2025.6.30 Amazon Linux 2 support ended] Amazon Linux server migration solution

[2025.6.30 Amazon Linux 2 support ended] Amazon Linux server migration solution

[Osaka/Yokohama] Actively recruiting infrastructure engineers and server side engineers!

[Osaka/Yokohama] Actively recruiting infrastructure engineers and server side engineers!

The person who wrote this article

About the author

Hide@Infrastructure Engineer

It all started with a very interesting interview.
A mid-career employee of the System Solutions Department in Osaka.My
job is to build and operate servers and clouds!
I have the qualifications of LPIC1, AWS SAA, and OCI Architect Associate.

Actually, I love ramen and
have investigated over 100 stores in Osaka (。-∀-) I'm striving to become the Ramen King of Nibi Beyond
!

I'm also on Twitter, so please follow me (´∇`)
Click on the Twitter mark on the right corner! !