1

Is it possible to set the user-agent in an HTTP request? I tried the following:

$http({
        method: 'GET',
        url: 'http://rest-service.guides.spring.io/greeting',
        headers: {
            'User-Agent' : 'app/2.0 (Android 4.3) sec=some_key'
        }

     })

But my browser says:

Refused to set unsafe header "User-Agent"

schirrmacher
  • 2,341
  • 2
  • 27
  • 29

1 Answers1

0

There is a way in backend specific solution.

Call your own rest service with default header parameters and then in your rest service call another rest service which is you want to call , with custom User-Agent header( Restception :) ). Then you can get your data from your own rest service.

hon2a points the link, that has similar problem. XMLHttpRequest Termination

İlker Korkut
  • 3,129
  • 3
  • 30
  • 51