square / retrofit

A type-safe HTTP client for Android and the JVM

Home Page:https://square.github.io/retrofit/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AWS WAF rule for antibot okhttp blocked my request

Allan-Nava opened this issue · comments

Hi, i'm using cloudfront for my api login application and with the base rule of aws waf I got this problem:

x-amz-cf-id: 0V6LXXHX4qL_xlDfhvFTPe3TIgSCHmcrM_UN-EeQCzxGSF0ucca2lg==
2023-08-29 17:04:24.416 14292-14365 OkHttp                  com.feftv.app                        D  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2023-08-29 17:04:24.416 14292-14365 OkHttp                  com.feftv.app                        D  <HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
2023-08-29 17:04:24.416 14292-14365 OkHttp                  com.feftv.app                        D  <TITLE>ERROR: The request could not be satisfied</TITLE>
2023-08-29 17:04:24.416 14292-14365 OkHttp                  com.feftv.app                        D  </HEAD><BODY>
2023-08-29 17:04:24.416 14292-14365 OkHttp                  com.feftv.app                        D  <H1>403 ERROR</H1>
2023-08-29 17:04:24.416 14292-14365 OkHttp                  com.feftv.app                        D  <H2>The request could not be satisfied.</H2>
2023-08-29 17:04:24.416 14292-14365 OkHttp                  com.feftv.app                        D  <HR noshade size="1px">
2023-08-29 17:04:24.416 14292-14365 OkHttp                  com.feftv.app                        D  Request blocked.
2023-08-29 17:04:24.416 14292-14365 OkHttp                  com.feftv.app                        D  We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
2023-08-29 17:04:24.416 14292-14365 OkHttp                  com.feftv.app                        D  <BR clear="all">
2023-08-29 17:04:24.416 14292-14365 OkHttp                  com.feftv.app                        D  If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
2023-08-29 17:04:24.416 14292-14365 OkHttp                  com.feftv.app                        D  <BR clear="all">
2023-08-29 17:04:24.416 14292-14365 OkHttp                  com.feftv.app                        D  <HR noshade size="1px">
2023-08-29 17:04:24.416 14292-14365 OkHttp                  com.feftv.app                        D  <PRE>
2023-08-29 17:04:24.416 14292-14365 OkHttp                  com.feftv.app                        D  Generated by cloudfront (CloudFront)
2023-08-29 17:04:24.416 14292-14365 OkHttp                  com.feftv.app                        D  Request ID: 0V6LXXHX4qL_xlDfhvFTPe3TIgSCHmcrM_UN-EeQCzxGSF0ucca2lg==
2023-08-29 17:04:24.416 14292-14365 OkHttp                  com.feftv.app                        D  </PRE>
2023-08-29 17:04:24.416 14292-14365 OkHttp                  com.feftv.app                        D  <ADDRESS>
2023-08-29 17:04:24.416 14292-14365 OkHttp                  com.feftv.app                        D  </ADDRESS>
2023-08-29 17:04:24.416 14292-14365 OkHttp                  com.feftv.app                        D  </BODY></HTML>
2023-08-29 17:04:24.416 14292-14365 OkHttp                  com.feftv.app                        D  <-- END HTTP (919-byte body)

Retrofit has no control over this. The library hands OkHttp and a request and it executes it. You would get the same response if you used OkHttp directly, or presumably any other HTTP client.

I don't know anything about Cloudfront, but presumably it has some documentation on how you can avoid hitting this from API clients.