try fix google 503
diff --git a/code/default/gae_proxy/local/gae_handler.py b/code/default/gae_proxy/local/gae_handler.py
index 0aa8dac705..865a2e0da0 100644
--- a/code/default/gae_proxy/local/gae_handler.py
+++ b/code/default/gae_proxy/local/gae_handler.py
@@ -437,7 +437,7 @@ def request_gae_proxy(method, url, headers, body, timeout=None):
     raise GAE_Exception(600, b"".join(error_msg))
 
 
-def handler(method, url, headers, body, wfile):
+def handler(method, host, url, headers, body, wfile):
     if not url.startswith("http") and not url.startswith("HTTP"):
         xlog.error("gae:%s", url)
         return
@@ -524,6 +524,19 @@ def handler(method, url, headers, body, wfile):
             continue
         response_headers[key] = value
 
+    if (response.status == 503 and
+            response_headers.get('Server') == 'HTTP server (unknown)' and
+            host.endswith(front.config.GOOGLE_ENDSWITH) and
+            host not in front.config.HOSTS_DIRECT):
+        if host in front.config.HOSTS_GAE:
+            try:
+                hosts_gae = list(front.config.HOSTS_GAE)
+                hosts_gae.remove(host)
+                front.config.HOSTS_GAE = tuple(hosts_gae)
+            except ValueError:
+                pass
+        front.config.HOSTS_DIRECT += host,
+
     response_headers["Persist"] = ""
     response_headers["Connection"] = "Persist"
 
diff --git a/code/default/gae_proxy/local/proxy_handler.py b/code/default/gae_proxy/local/proxy_handler.py
index 726beb309d..8b3776ae1f 100644
--- a/code/default/gae_proxy/local/proxy_handler.py
+++ b/code/default/gae_proxy/local/proxy_handler.py
@@ -237,7 +237,7 @@ def do_METHOD(self):
                 return self.go_DIRECT()
             else:
                 xlog.debug("Host:%s Direct redirect to https", host)
-                return self.wfile.write(('HTTP/1.1 301\r\nLocation: %s\r\nContent-Length: 0\r\n\r\n' % self.path.replace('http://', 'https://', 1)).encode())
+                return self.wfile.write(('HTTP/1.1 301\r\nLocation: %s\r\nContent-Length: 0\r\n\r\n' % self.url.replace('http://', 'https://', 1)).encode())
 
         if host.endswith(front.config.HOSTS_GAE_ENDSWITH):
             return self.go_AGENT()
@@ -297,7 +297,7 @@ def get_crlf(rfile):
             return self.wfile.write(('HTTP/1.1 404 Not Found\r\n\r\n').encode())
 
         xlog.debug("GAE %s %s from:%s", self.command, self.url, self.address_string())
-        gae_handler.handler(self.command, self.url, request_headers, payload, self.wfile)
+        gae_handler.handler(self.command, self.host, self.url, request_headers, payload, self.wfile)
 
     def go_DIRECT(self):
         xlog.debug('DIRECT %s %s', self.command, self.url)

基于性能和复杂度考虑，没有检查内容，不知道有没有误检。

试了很多次搜索还是没触发 503，懒得试了。。。