0

Our application uses the Chromium Embedded Framework. We need a way to communicate to our servers within our requests that they are communicating with a Chrome browser embedded in our application. Changing the user agent isn't really an option because some sites do not play well with browsers which are not recognized. I suppose we could get around this by appending the application name to the end of the default Chromium user agent header. Our server could then check to see if the user agent header contains the name of our application. I'm unsure though if some sites will still have an issue recognizing our application with this method. I'm also unsure if there is better way to indicate this, maybe through the use of cookie or setting a custom field on the request header?

user2481095
  • 2,024
  • 7
  • 22
  • 32
  • 1
    This hardly depends from requirements. Generally i vote for custom headers as most balanced way (as for me). Cookie also should work if you know how to cook them. :) Any other ways looks as more complex, but potentially may has new attributes. Say, you can implement some kind of app authentication which will be harder to imitate in usual browser. On other side, cookie with app name are easier to imitate in standard browser. I think you can safe enough to add app name in UA, but, you you will need hardcode it, or write some additional code to get original UA and append to it, but... – Dmitry Azaraev Oct 09 '18 at 00:26
  • ...but on the way to do this, you already will override UA in few places including request header, that should turn you that just passing custom request header is balanced way. :) – Dmitry Azaraev Oct 09 '18 at 00:28
  • 2
    I'd vote for custom header as well, it's simple and clean. You can see https://stackoverflow.com/questions/31250797/chromium-send-custom-header-info-on-initial-page-load-c-sharp for a rough example, you can inherit from http://cefsharp.github.io/api/67.0.0/html/T_CefSharp_Handler_DefaultRequestHandler.htm and just override the required methods to keep things simple. That's assuming you are using version `67` (current stable version). – amaitland Oct 09 '18 at 06:35

0 Answers0