Closed naglis closed 6 years ago
Hi @naglis,
Thanks for the bug report and I agree it's not behaving as expected. Here's how I think it should work:
User-Agent
header from the cred fileUser-Agent
header in the cred file, grab a random one--useragent
switch, force the User-Agent
to the specified valuePlease let me know if that would fix your use case.
Thanks, Zach
Hi,
while trying to add credentials for Odoo, I have stumbled upon a weird corner case with user agent headers.
Upon successful login, Odoo redirects the user to either a user given URL (unvalidated redirect :/) or base back-office URL, but the redirect method is different depending on the user agent.
I am using the redirect as an indicator for login success, and I need a constant user agent in order to get consistent results.
It turns out, changeme by default uses a random user agent from a predefined list.
I have tried setting the
headers
inauth
block, but it appears that the user agent is overwritten with the one selected by changeme afterwards, so, no luck :/It works great if I pass my user agent via CLI parameters, however, this is not an optimal solution.
I have tried to change the order in which the headers are calculated, so that custom headers from the credentials file are applied afterwards, eg.:
and it seems to work great. However, I was not sure if the previous header evaluation order was intentional or not. Please let me know if you think the solution is suitable, and I'll gladly make a PR.