allOrigins icon indicating copy to clipboard operation
allOrigins copied to clipboard

Feature request: Allow overriding User-Agent header

Open kerrickstaley opened this issue 2 years ago • 1 comments

Certain APIs will block access for clients without a browser-like user-agent. For example, the request

curl 'https://mybusnow.njtransit.com/bustime/eta/getStopPredictionsETA.jsp?stop=20509'

returns an HTML page with an error message. This error is also visible when you try to access the API through allorigins.win.

However, if you pass a browser-like user-agent, the request returns XML with bus departure times:

curl 'https://mybusnow.njtransit.com/bustime/eta/getStopPredictionsETA.jsp?stop=20509' \
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0'

I think it'd be useful if allOrigins could take a &user_agent= parameter that overrides the user-agent in order to allow access to APIs like this.

kerrickstaley avatar Jul 06 '23 03:07 kerrickstaley

Would be great indeed! Could as well be extended to allow for custom request headers by passing a url-param headers={}&url=url json object which could include User-Agent, Authorization or anything like these.

jo-chemla avatar Jul 26 '24 15:07 jo-chemla