[openstack-dev] [swift] Can swift identify user agent come from chrome browser?

Samuel Merritt sam at swiftstack.com
Thu Mar 17 18:54:44 UTC 2016


On 3/17/16 1:53 AM, Linpeimin wrote:
> Hello, everyone.
>
> I have config a web server (tengine) as a proxy server for swift, and
> sent a GET request via a chrome browser in order to access swift
> container. From the log file, it can be seen that web server has pass
> the request to swift, but swift returns an unauthorized error. Log file
> record like this:
>
> Access logs of *tengine:*
>
> 10.74.167.183 - - [17/Mar/2016:16:30:03 +0000] "GET /auth/v1.0 HTTP/1.1"
> 401 131 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36
> (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36" "-"
>
> 10.74.167.183 - - [17/Mar/2016:16:30:03 +0000] "GET /favicon.ico
> HTTP/1.1" 401 649 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64)
> AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72
> Safari/537.36" "-"
>
> Proxy logs of *swift*:
>
> Mar 17 15:12:27 localhost journal: proxy-logging 10.74.167.183
> 192.168.1.5 17/Mar/2016/15/12/27 GET /auth/v1.0 HTTP/1.0 401 -
> Mozilla/5.0%20%28Windows%20NT%206.1%3B%20WOW64%29%20AppleWebKit/537.36%20%28KHTML%2C%20like%20Gecko%29%20Chrome/28.0.1500.72%20Safari/537.36
> - - 131 - tx21863381504d47098a73846d621fcbd0 - 0.0003 -
>
> Mar 17 15:12:27 localhost journal: tempauth 10.74.167.183 192.168.1.5
> 17/Mar/2016/15/12/27 GET /auth/v1.0 HTTP/1.0 401 -
> Mozilla/5.0%20%28Windows%20NT%206.1%3B%20WOW64%29%20AppleWebKit/537.36%20%28KHTML%2C%20like%20Gecko%29%20Chrome/28.0.1500.72%20Safari/537.36
> - - - - tx21863381504d47098a73846d621fcbd0 - 0.0013

It's the same value, just URL-encoded. Swift's access log is formatted 
as one record per line, with fields delimited by spaces. Since the 
user-agent string may contain spaces, it's escaped before logging so 
that the log formatting isn't broken.




More information about the OpenStack-dev mailing list