autoupdate: select correct x_forwarded_host

If the X-Forwarded-Host header field has multiple values, current code
is not selecting the correct value. Update GetDevserverUrl() so that the
right most host is selected.

BUG=chromium:1082085
TEST=Manually tested on chromeos2-devservertest

Change-Id: I194574a2cccb8295b72d4dbb80401c785e6c5e60
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/2216809
Tested-by: Sanika Kulkarni <sanikak@chromium.org>
Reviewed-by: Congbin Guo <guocb@chromium.org>
Commit-Queue: Congbin Guo <guocb@chromium.org>
Auto-Submit: Sanika Kulkarni <sanikak@chromium.org>
diff --git a/autoupdate.py b/autoupdate.py
index cd26507..88def64 100644
--- a/autoupdate.py
+++ b/autoupdate.py
@@ -101,6 +101,9 @@
     """Returns the devserver url base."""
     x_forwarded_host = cherrypy.request.headers.get('X-Forwarded-Host')
     if x_forwarded_host:
+      # Select the left most <ip>:<port> value so that the request is
+      # forwarded correctly.
+      x_forwarded_host = [x.strip() for x in x_forwarded_host.split(',')][0]
       hostname = 'http://' + x_forwarded_host
     else:
       hostname = cherrypy.request.base