[英]How to configure custom domain for App Engine for service that is not the defautl in GCP?
[英]GCP App Engine Firewall Rules Failing For Custom Domain
我的目標是將我的 App Engine 服務的訪問權限限制在我的家庭辦公室 IP。 我已經為 App Engine 防火牆配置了我的 IPv4 和 IPv6 地址的允許規則,並將默認規則設置為拒絕。
這在使用分配給我的應用程序的唯一 appspot.com 地址瀏覽我的應用程序時有效。 但是嘗試使用我為 App Engine 配置的自定義域訪問我的應用程序會導致 403。
我進一步驗證了這些規則在 apppot.com 域上按預期工作。 不在我的允許列表中的任何內容都會按預期獲得 403。
這告訴我我的規則是“有效的”,但我找不到任何關於為什么這不會影響通過配置的自定義域訪問我的應用程序的參考。
注意:當默認規則設置為允許時,我的應用程序確實使用自定義域工作,所以我確信配置是正確的。
自定義域是否超出了 App Engine 防火牆的 scope? 我希望暫時避免深入研究 VPC 配置。
編輯:在跟蹤日志時,日志將我的 IPv6 IP 地址顯示為請求的 IP:
{
"entries": [
{
"insertId": "dlpqxpfa090t8",
"jsonPayload": {
"appLatencySeconds": "0.011",
"trace": "b7f63eb3d2fb4c52480253c224821a23",
"latencySeconds": "0.011"
},
"httpRequest": {
"requestMethod": "GET",
"requestUrl": "/users/kind/add",
"status": 200,
"responseSize": "4810",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.81 Safari/537.36",
"remoteIp": "2600:****:****:****:****:****:****:9936",
"referer": "https://f******s.e******t.com/users",
"latency": "0.011s",
"protocol": "HTTP/1.1"
},
"resource": {
"type": "gae_app",
"labels": {
"zone": "",
"project_id": "f*******s",
"version_id": "20220801t212517",
"module_id": "default"
}
},
"timestamp": "2022-08-09T22:11:33.869Z",
"labels": {
"appengine.googleapis.com/trace_id": "b*****************a23",
"appengine.googleapis.com/instance_name": "aef-default-2*********7-770v",
"compute.googleapis.com/resource_name": "0**********3",
"compute.googleapis.com/resource_id": "21*********29",
"compute.googleapis.com/zone": "********"
},
"logName": "projects/f********s/logs/appengine.googleapis.com%2Fnginx.request",
"trace": "projects/f*********s/traces/b7f63eb3d2fb4c52480253c224821a23",
"receiveTimestamp": "2022-08-09T22:11:38.104875464Z"
}
]
}
編輯 2:正如評論中所建議的,我嘗試使用 curl 擊中 URL。 結果如下:
Microsoft Windows [Version 10.0.22000.856]
(c) Microsoft Corporation. All rights reserved.
C:\Users\shawn>curl
curl: try 'curl --help' for more information
C:\Users\shawn>curl https://f*****s.e*******t.com/index
<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>403 Forbidden</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Forbidden</h1>
<h2>Access is forbidden.</h2>
<h2></h2>
<script defer src="https://static.cloudflareinsights.com/beacon.min.js/v652eace1692a40cfa3763df669d7439c1639079717194" integrity="sha512-Gi7xpJR8tSkrpF7aordPZQlW2DLtzUlZcumS8dMQjwDHEnw9I7ZLyiOj/6tZStRBGtGgN6ceN6cMH8z7etPGlw==" data-cf-beacon='{"rayId":"738c818088a17d62","version":"2022.6.0","r":1,"token":"c070c2d4c5ad48d18815371af21d9e80","si":100}' crossorigin="anonymous"></script>
</body></html>
C:\Users\shawn>
注意:我認為我認為 IPv6 是罪魁禍首,但我已經完全禁用了 IPv6,並且https://whatismyipaddress.com/表明我不再廣播 IPv6 地址。 還是沒有骰子。
Cloudflare 代理 CNAME 再次來襲。 在 Cloudflare 中為指向 ghs.googlehosted.com 的 CNAME 關閉此功能大約 5 分鍾后解決了該問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.