XX-net/XX-Net · info

go_AGENT OPTIONS not supported by GAE

Error message

go_AGENT OPTIONS not supported by GAE

What it means

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.

Source

Thrown at code/default/gae_proxy/local/proxy_handler.py:268

        # avoid key word filter when pass through GFW
        if host in front.config.HOSTS_DIRECT:
            return self.go_DIRECT()

        if host.endswith(front.config.HOSTS_GAE_ENDSWITH):
            return self.go_AGENT()

        if host.endswith(front.config.HOSTS_DIRECT_ENDSWITH):
            return self.go_DIRECT()

        return self.go_AGENT()

    # Called by do_METHOD and do_CONNECT_AGENT
    def go_AGENT(self):
        request_headers = dict((k.title(), v) for k, v in list(self.headers.items()))
        payload = self.read_payload()

        if self.command == b"OPTIONS":
            xlog.warn("go_AGENT OPTIONS not supported by GAE")
            return self.send_method_allows(request_headers, payload)

        if self.command not in self.gae_support_methods:
            xlog.warn("Method %s not support in GAEProxy for %s", self.command, self.path)
            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())
        if gae_handler.handler(self.command, self.host, self.url, request_headers, payload, self.wfile, self.go_DIRECT) != "ok":
            self.close_connection = 1

    def go_DIRECT(self):
        if not self.url.startswith(b"https"):
            xlog.debug("Host:%s Direct redirect to https", self.host)
            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))

        request_headers = dict((k.title(), v) for k, v in list(self.headers.items()))
        payload = self.read_payload()

View on GitHub (pinned to cfa5bc17b6)

Solutions

  1. If CORS fails, serve the API so browsers can use simple requests (avoid preflight) or handle OPTIONS at your origin reached via DIRECT
  2. Add the site to the proxy's direct/bypass list so OPTIONS goes to the real server
  3. Accept the canned response if the client only needs any 2xx with Allow header
  4. No proxy-side fix exists: GAE's urlfetch cannot forward OPTIONS
Defensive patterns

Strategy: fallback

Validate before calling

if os.environ.get('REQUEST_METHOD') == 'OPTIONS':
    # route to direct origin, GAE can't forward OPTIONS
    pass

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of XX-net/XX-Net@cfa5bc17b6 (2026-08-27). Data as JSON: /api/errors/f70d04d1b386a424. Report an issue: GitHub.