MicFin
MicFin

Reputation: 2501

Can a rails application identify when a request is from curl?

A rails application can use the request object to access user agent and more data about the request. How to detect browser type and its version

But with curl, a developer can set the header data and more. How to use curl to get a GET request exactly same as using Chrome?

Can a rails application accurately detect when a request is sent by a software like curl versus a browser?

Upvotes: 0

Views: 206

Answers (1)

John Ellmore
John Ellmore

Reputation: 2229

No. cURL can simulate any HTTP request with the correct configuration. There is no way to tell the difference between Chrome and cURL from an HTTP request alone.

If you're trying to make it harder to scrape data from your server, you'll want to use other methods (rate-limiting, authentication, etc.). But there is no perfect solution to prevent a determined scraper.

Upvotes: 4

Related Questions