Skip to content

Instantly share code, notes, and snippets.

@guyromm
Last active July 11, 2016 14:51
Show Gist options
  • Select an option

  • Save guyromm/e135afeea1e1f4774bbc to your computer and use it in GitHub Desktop.

Select an option

Save guyromm/e135afeea1e1f4774bbc to your computer and use it in GitHub Desktop.
quick'n'dirty apache2 authenticated http proxy
# quick'n'dirty apache2 authenticated proxy
# do not forget to a2enmod auth_digest , proxy , proxy_*
ProxyRequests On
ProxyVia Off
<Directory /var/www/html>
Options -Indexes
</Directory>
<Proxy "*">
Require valid-user
AuthType Digest
AuthName "proxy"
#AuthDigestDomain / http://mirror.my.dom/private2/
AuthDigestProvider file
AuthUserFile /etc/apache2/auth.digest
#host internal.example.com
</Proxy>
<Location />
Require valid-user
</Location>
#flask server script to test headers.
from flask import Flask
app = Flask(__name__)
from flask import request
@app.route('/')
def index():
print request.headers
rt= "route: "+str(request.access_route)+" ; x-forwarded-for: '"+str(request.headers.getlist("X-Forwarded-For"))+"'"
print rt
return rt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment