Snippets are unofficial and unmaintained.
This is an archived view of user-submitted snippets. Despite being hosted on the Flask site, they are not official. No Flask maintainer has curated or checked the snippets for security, correctness, or design.
# -*- coding: utf-8 -*- 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()
This snippet by Zeray Rice can be used freely for anything you like. Consider it public domain.