Skip to content

Add user-agent header to every http request.#5

Open
dejano wants to merge 1 commit into
robertoestivill:masterfrom
dejano:add-user-agent-request-interceptor
Open

Add user-agent header to every http request.#5
dejano wants to merge 1 commit into
robertoestivill:masterfrom
dejano:add-user-agent-request-interceptor

Conversation

@dejano

@dejano dejano commented Aug 19, 2017

Copy link
Copy Markdown

New api #4 is running behind CloudFlare which requires user-agent header to be sent. If it isn't, response is always 403 with following error message:

The owner of this website (yts.ag) has banned your access based on your browser's signature

New api is running behind CloudFlare which requires user-agent header to be sent. If it isn't, response is always 403 with following error message:

`The owner of this website (yts.ag) has banned your access based on your browser's signature`

public class UserAgentInterceptor implements RequestInterceptor {

private static final String USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36";

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the approach with the interceptor, but I don't think we should use a browser user agent.
I think we should allow the client of the library to customize this. Maybe something like withUserAgent(String)
I will try a few things during the weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants