0

F5 irule之google站长认证别样用法

 3 months ago
source link: https://bajie.dev/posts/20240118-f5_irule/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

F5 Irule之google站长认证别样用法

2024-01-18 1 分钟阅读

公司的网站要过google认证,需要在网站根目录下放一个文件,googleb1e6d9a50ea8xxxx.html

内容如下:

google-site-verification: googleb1e6d9a50ea8xxxx.html  

这个无比简单,怎么又跟F5和irule扯上关系了呢?!

哎,因为居然要做两个域名,m.xxx.com和h.xxx.com,这两个域名都要过认证,而且悲剧的是,这两个域名实际代理的是同一台后端服务器的同一个tomcat进程。

鉴于这个东西这么简单,干脆在F5上来一段irule解决问题:

when HTTP_REQUEST {  
 if { ([string tolower [HTTP::path]] starts_with "/googleb1e6d9a50ea8xxxx.html") && ([string tolower [HTTP::host]] equals "m.xxx.com") } {
  HTTP::respond 200 content "google-site-verification: googleb1e6d9a50ea8xxxx.html"
 }
}

由于没有复用ip,所以在h.xxx.com同样修改以上脚本并应用即可。

如果是穷光蛋作风,在F5上复用了IP做了虚拟主机转发,也修改修改脚本即可。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK