Skip to content

Instantly share code, notes, and snippets.

@hlecuanda
Created April 2, 2017 03:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hlecuanda/00d09dc1fe77bad969d52b537633b9f5 to your computer and use it in GitHub Desktop.
Save hlecuanda/00d09dc1fe77bad969d52b537633b9f5 to your computer and use it in GitHub Desktop.
A reverse proxy, to enable custom domain names on the new google sites; using Google App Engine
# -*- coding: utf-8 -*-
# Based on http://flask.pocoo.org/snippets/118/
from flask import Flask
from flask import Response
from flask import stream_with_context
import requests
app = Flask(__name__)
@app.route('/<path:url>')
def home(url):
req = requests.get(url, stream = True)
return Response(stream_with_context(req.iter_content()),
content_type = req.headers['content-type'])
if __name__ == '__main__':
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment