{"record":{"id":"f70d04d1b386a424","repo":"XX-net/XX-Net","slug":"go-agent-options-not-supported-by-gae","errorCode":null,"errorMessage":"go_AGENT OPTIONS not supported by GAE","messagePattern":"go_AGENT OPTIONS not supported by GAE","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"code/default/gae_proxy/local/proxy_handler.py","lineNumber":268,"sourceCode":"        # avoid key word filter when pass through GFW\n        if host in front.config.HOSTS_DIRECT:\n            return self.go_DIRECT()\n\n        if host.endswith(front.config.HOSTS_GAE_ENDSWITH):\n            return self.go_AGENT()\n\n        if host.endswith(front.config.HOSTS_DIRECT_ENDSWITH):\n            return self.go_DIRECT()\n\n        return self.go_AGENT()\n\n    # Called by do_METHOD and do_CONNECT_AGENT\n    def go_AGENT(self):\n        request_headers = dict((k.title(), v) for k, v in list(self.headers.items()))\n        payload = self.read_payload()\n\n        if self.command == b\"OPTIONS\":\n            xlog.warn(\"go_AGENT OPTIONS not supported by GAE\")\n            return self.send_method_allows(request_headers, payload)\n\n        if self.command not in self.gae_support_methods:\n            xlog.warn(\"Method %s not support in GAEProxy for %s\", self.command, self.path)\n            return self.wfile.write(('HTTP/1.1 404 Not Found\\r\\n\\r\\n').encode())\n\n        xlog.debug(\"GAE %s %s from:%s\", self.command, self.url, self.address_string())\n        if gae_handler.handler(self.command, self.host, self.url, request_headers, payload, self.wfile, self.go_DIRECT) != \"ok\":\n            self.close_connection = 1\n\n    def go_DIRECT(self):\n        if not self.url.startswith(b\"https\"):\n            xlog.debug(\"Host:%s Direct redirect to https\", self.host)\n            return self.wfile.write(b'HTTP/1.1 301\\r\\nLocation: %s\\r\\nContent-Length: 0\\r\\n\\r\\n' % self.url.replace(b'http://', b'https://', 1))\n\n        request_headers = dict((k.title(), v) for k, v in list(self.headers.items()))\n        payload = self.read_payload()\n","sourceCodeStart":250,"sourceCodeEnd":286,"githubUrl":"https://github.com/XX-net/XX-Net/blob/cfa5bc17b67676e467f37ec50766127e0ab5f0aa/code/default/gae_proxy/local/proxy_handler.py#L250-L286","documentation":"go_AGENT received an HTTP OPTIONS request. Google App Engine's fetch API cannot represent OPTIONS responses, so GAEProxy explicitly warns and falls back to send_method_allows(), which fabricates a canned Allow response instead of forwarding.","triggerScenarios":"Any client sends OPTIONS (CORS preflight, feature detection from web apps) through the proxy to a GAE-forwarded URL; go_AGENT intercepts it before the method-support check.","commonSituations":"Browser CORS preflights for cross-origin XHR routed through GAEProxy; REST tooling issuing OPTIONS discovery. The canned Allow response may not match the real origin's allowed methods, causing app-level CORS quirks — not a proxy crash.","solutions":["If CORS fails, serve the API so browsers can use simple requests (avoid preflight) or handle OPTIONS at your origin reached via DIRECT","Add the site to the proxy's direct/bypass list so OPTIONS goes to the real server","Accept the canned response if the client only needs any 2xx with Allow header","No proxy-side fix exists: GAE's urlfetch cannot forward OPTIONS"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"if os.environ.get('REQUEST_METHOD') == 'OPTIONS':\n    # route to direct origin, GAE can't forward OPTIONS\n    pass","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Design APIs to avoid CORS preflight (simple requests) when proxied via GAE","Put OPTIONS-needing origins on the direct/bypass list","Return a correct Allow header from the real origin, not the proxy"],"tags":["http-proxy","options","cors","gae-limitation"],"backgroundTag":"http-method-not-supported","analyzedSha":"cfa5bc17b67676e467f37ec50766127e0ab5f0aa","analyzedAt":"2026-08-27T19:28:28.225Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}