Updated gateway script to account for proxy mode detection.

Signed-off-by: Sean V Kelley <seanvk@ortracks.org>