openapi-cop icon indicating copy to clipboard operation
openapi-cop copied to clipboard

302 redirect causes max redirects error

Open cobyforrester opened this issue 3 years ago • 0 comments

Sorry to spam the repo with issues.

The response that is returned to the proxy is:

< HTTP/1.1 302 FOUND
< Server: Werkzeug/2.2.2 Python/3.10.7
< Date: Mon, 26 Sep 2022 22:33:59 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 669
< Location: $REDURECT_URL
< Vary: Cookie
< Set-Cookie: session=$COOKIE HttpOnly; Path=/
< Connection: close
< 
<!doctype html>
<html lang=en>
<title>Redirecting...</title>
<h1>Redirecting...</h1>
<p>You should be redirected automatically to the target URL: <a href="$REDURECT_URL">$REDURECT_URL</a>. If not, click the link.

However, when proxied through openapi-cop, I get this error Error: Exceeded maxRedirects. Probably stuck in a redirect loop $REDIRECT_URL. With the server outputting this:

(node:8) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 pipe listeners added. Use emitter.setMaxListeners() to increase limit
2022-09-26T22:34:53.451Z openapi-cop:proxy Validation results [GET /api/user/signin] 
{
  "request": {
    "valid": true,
    "errors": null
  }
}
2022-09-26T22:34:53.456Z openapi-cop:proxy Could not send request: Error: Exceeded maxRedirects. Probably stuck in a redirect loop $REDIRECT_URL

This makes the proxy unusable for endpoints that redirect.

cobyforrester avatar Sep 26 '22 22:09 cobyforrester