Should the browser extension change the User-Agent header for triggered requests?
We are developing a browser extension that, as part of its feature set, connects to an external API (on our servers) to load data.
For several reasons, it is useful to know which version of the extension is connecting to the API. It can be useful to keep track of update rates between versions, but on a less conspicuous note of tinfoil-hat, we may need to respond to the API differently based on bugs found in older versions of the extension.
What's the best way for an extension to let the server know which version is running?
Add information to existing User-Agent header? (i.e. this request is sent from my extension inside this browser)
User-Agent: Mozilla/5.0 (…) Firefox/3.6.3 (MyPlugin/22.214.171.1246)
Replace the User-Agent header completely? (i.e. this request is sent with an extension, and since it is not displayed by the browser, the original UA string is irrelevant)
Add a separate request header just to track this information? (i.e. this request is still being sent from the internal host browser, but also more info here for you)
User-Agent: Mozilla/5.0 (…) Firefox/3.6.3
Option 3 sounds a little bit to me because the specific purpose of the User-Agent header is to convey information about the program making the request, but I don't know if there is any specific recommendation between the other two options
source to share
I think option 2. The reason for this is because the browser is not making the request to the endpoint, but your plugin code, which could be interpreted as a separate process.
Thinking for the future, that if your plugin was a standalone application or similar - then it wouldn't make sense to have some agents with one format and some with others.
This also assumes that any relevant browser information you might need is in the UA plugin.
source to share