Add proxy support

parent 86702bbe
......@@ -6,6 +6,8 @@ from flask_login import LoginManager
from flask_jwt_extended import JWTManager
from config import config
import colorlog
from werkzeug.middleware.proxy_fix import ProxyFix
# Initialize extensions
db = SQLAlchemy()
......@@ -18,6 +20,7 @@ def create_app(config_name=None):
config_name = os.environ.get('FLASK_ENV', 'default')
app = Flask(__name__)
app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_proto=1, x_host=1, x_port=1, x_prefix=1)
app.config.from_object(config[config_name])
config[config_name].init_app(app)
......
......@@ -5,6 +5,7 @@ import shutil
from flask import request, jsonify, render_template, redirect, url_for, flash, current_app
from flask_login import login_required, current_user
from flask_jwt_extended import jwt_required, get_jwt_identity
from flask_wtf.csrf import csrf
from werkzeug.utils import secure_filename
from app.upload import bp
from app import db
......@@ -904,6 +905,7 @@ def upload_fixture_zip(fixture_id):
return redirect(request.referrer or url_for('main.fixtures'))
@bp.route('/chunk', methods=['POST'])
@csrf.exempt
@login_required
@require_active_user
def upload_chunk():
......@@ -944,9 +946,11 @@ def upload_chunk():
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/finalize', methods=['POST'])
@csrf.exempt
@login_required
@require_active_user
def finalize_upload():
pass
"""Finalize chunked upload"""
try:
data = request.get_json()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment