Can I forward env variables over ssh?

You can, but it requires changing the server configuration. Read the entries for AcceptEnv in sshd_config(5) and SendEnv in ssh_config(5). update: You can also pass them on the command line: ssh foo@host “FOO=foo BAR=bar doz” Regarding security, note than anybody with access to the remote machine will be able to see the environment variables passed … Read more

How to use HTTP_X_FORWARDED_FOR properly?

You can use this function to get proper client IP: public function getClientIP(){ if (array_key_exists(‘HTTP_X_FORWARDED_FOR’, $_SERVER)){ return $_SERVER[“HTTP_X_FORWARDED_FOR”]; }else if (array_key_exists(‘REMOTE_ADDR’, $_SERVER)) { return $_SERVER[“REMOTE_ADDR”]; }else if (array_key_exists(‘HTTP_CLIENT_IP’, $_SERVER)) { return $_SERVER[“HTTP_CLIENT_IP”]; } return ”; }

Python: Get HTTP headers from urllib2.urlopen call?

Use the response.info() method to get the headers. From the urllib2 docs: urllib2.urlopen(url[, data][, timeout]) … This function returns a file-like object with two additional methods: geturl() — return the URL of the resource retrieved, commonly used to determine if a redirect was followed info() — return the meta-information of the page, such as headers, … Read more