forked from antarctica/flask-reverse-proxy-fix
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.py
38 lines (27 loc) · 793 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from flask import Flask, jsonify, url_for
from flask_reverse_proxy_fix.middleware import ReverseProxyPrefixFix
def create_app_with_middleware():
app = Flask(__name__)
# Configure and load Middleware
app.config['REVERSE_PROXY_PATH'] = '/test'
ReverseProxyPrefixFix(app)
@app.route("/sample")
def sample():
payload = {
'links': {
'self': url_for('.sample', _external=True)
}
}
return jsonify(payload)
return app
def create_app_without_middleware():
app = Flask(__name__)
@app.route("/sample")
def sample():
payload = {
'links': {
'self': url_for('.sample', _external=True)
}
}
return jsonify(payload)
return app