根据调用另一个App Engine应用程序时的文档:
If you are making requests to another App Engine app, you should consider telling the UrlFetch service to not follow redirects when invoking it.
到目前为止,还没有关于如何编辑该功能并告诉服务不遵循重定向的文档,所以有人知道这个技巧吗?
答案 0 :(得分:0)
您必须设置
follow_redirects = false
调用fetch时。
使用抓取进行标准通话
fetch(url, payload=None, method=GET, headers={},
allow_truncated=False, follow_redirects=True, deadline=5,
validate_certificate=False)
将 follow_redirects改为false ,如下所示
fetch(url, payload=None, method=GET, headers={},
allow_truncated=False, follow_redirects=False, deadline=5,
validate_certificate=False)
<强> PHP 强>
$context = [
'http' => [
'method' => 'get',
'header' => "custom-header: custom-value\r\n" . "custom-header-two: custome-value-2\r\n",
'content' => $data,
'follow_location' => false,
]
];