I am trying to use Wurfl plugin for Nginx. I am using Openresty instead of Vanilla Nginx. I don't get correct User-Agent set in the User-Agent header. So I am trying to set the User-Agent header myself while I process the request. But I feel that Wurfl has already resolved the User-Agent present as part of header when the request hit the server. Is there a way to set the User-Agent value through the code and resolve the device capabilities on the newly set header.
How to set user agent in request header and then pass it to wurfl
1.1k Views Asked by visingh AtThere are 2 best solutions below
On
Luca Passani, ScientiaMobile CTO here. The WURFL Module for NGINX is a commercial product and as such all customers get direct support from our awesome support team. I suggest you contact ScientiaMobile directly and we will be more than happy to assist. Is there some reason why you are not comfortable using the standard support channels? Anyway if you post your configuration file here, I'll ask someone from the team to look into this thread. The fact that you cannot see the user-agent string is an indication that something is wrong (is it possible that you are looking at an HTTP request that has already been mangled with upstream?)
Here is an example of configuration from the documentation posted on our website:
WURFL Module NGINX Configuration
Thanks
Something that you might want to try is the 51Degrees Nginx module, the User-Agent remains unaffected when the detection is carried out, and the capabilities are set in a header of your choice. As it does not touch the User-Agent header other than to read it, you should be able to change it as much as you like.
Also, does it need to be changed before the detection? If not then the proxy_set_header will be fine. But if it needs to be set before you will have to use the set function (which I'm not certain can be used to set existing header).
Alternatively, if this is just for testing, then the Modify Headers addon for Firefox is very good for this, or even Apache Bench.