Spaces:
Runtime error
Runtime error
Commit ·
8e32b24
1
Parent(s): 6c25e08
Add proxy fix
Browse files
server.py
CHANGED
|
@@ -20,6 +20,7 @@ import chromadb
|
|
| 20 |
import posthog
|
| 21 |
from chromadb.config import Settings
|
| 22 |
from sentence_transformers import SentenceTransformer
|
|
|
|
| 23 |
|
| 24 |
colorama_init()
|
| 25 |
|
|
@@ -41,6 +42,10 @@ app = Flask(__name__)
|
|
| 41 |
CORS(app) # allow cross-domain requests
|
| 42 |
app.config["MAX_CONTENT_LENGTH"] = 100 * 1024 * 1024
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
def get_real_ip():
|
| 45 |
return request.environ.get('HTTP_X_FORWARDED_FOR', request.remote_addr)
|
| 46 |
|
|
|
|
| 20 |
import posthog
|
| 21 |
from chromadb.config import Settings
|
| 22 |
from sentence_transformers import SentenceTransformer
|
| 23 |
+
from werkzeug.middleware.proxy_fix import ProxyFix
|
| 24 |
|
| 25 |
colorama_init()
|
| 26 |
|
|
|
|
| 42 |
CORS(app) # allow cross-domain requests
|
| 43 |
app.config["MAX_CONTENT_LENGTH"] = 100 * 1024 * 1024
|
| 44 |
|
| 45 |
+
app.wsgi_app = ProxyFix(
|
| 46 |
+
app.wsgi_app, x_for=1, x_proto=1, x_host=1, x_prefix=1
|
| 47 |
+
)
|
| 48 |
+
|
| 49 |
def get_real_ip():
|
| 50 |
return request.environ.get('HTTP_X_FORWARDED_FOR', request.remote_addr)
|
| 51 |
|