So there are several use cases for a DDR service. I think you kind of miss both 
of them... :[

1) A client side (javascript) call is made to the DDR service by the actual 
client. In this case, the User-Agent field is correct.

2) A server side (code) or browser call (human) is made to the service to get 
the user-agent. In this case, the user-agent should be passed as a URL 
parameter, not a header. This is done for several reasons, most importantly 
caching and for ease of use if using a browser.

This is a very cryptic example, but if you look at the dClass varnish config, 
it supports 3 methods:

1) 
https://github.com/TheWeatherChannel/dClass/blob/master/servers/varnish/dclass.vcl#L106
2) 
https://github.com/TheWeatherChannel/dClass/blob/master/servers/varnish/dclass.vcl#L70

For option 1 it can return raw JSON or Javascript/JSONP.


________________________________
 From: eberhard speer jr. <[email protected]>
To: [email protected] 
Sent: Saturday, March 22, 2014 5:35 PM
Subject: "Bad Request"
 

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

yes, using the API URL in a browser would cause "Bad Request" because
the API requires the extra header : Ddr-User-Agent, as described in
the documentation.
The idea is that the API responds to a request to resolve "a"
user-agent string supplied in parameter [the Ddr-User-Agent http
header] and not the user-agent string of the device calling the API ;-)

[on Skype now]

esjr
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTLgIIAAoJEOxywXcFLKYcuscH/0YyJ6/hz/HWge+bVT6uPUmN
G+aYOXc9GKZqtMqMISOahVw024ZzMBjCP6XspdNycvQJ2UpxHCvU8oa2GGfvr14U
BW8vRxUpxP67aX5EzUdH972wPNDJriNfNiqd6w7BCjkuQpuCe7qpCpubm0ZzY5/0
QpB1hbRbkLELhuPHaTz/x7Y0gaKGHwYo/E5oFi7giFW1ttivE7oqZ8HyMviGKANb
WPlOM+mve9PkfzQwc0frc9y9N2Wb7DHM/rTk7rlbGtpLqJbG/trrurcXQKCj9pGi
4NlXuBqPjszjtU8HhAz/s7B2TfsLYEwmhsVz26S9QlGdlamg7ESWAYCtB28L7QI=
=RJSQ
-----END PGP SIGNATURE-----

Reply via email to