diff --git a/app/__init__.py b/app/__init__.py
index 3a1f54fc14b5e002a08fc4a31be30f8a502f0bd8..5e8a0d29292682b5111aa8e5fb1f52b49446fd98 100644
--- a/app/__init__.py
+++ b/app/__init__.py
@@ -7,6 +7,17 @@ from flask_sqlalchemy import SQLAlchemy
 import logging
 
 
+class CustomProxyFix(object):
+    def __init__(self, app):
+        self.app = app
+
+    def __call__(self, environ, start_response):
+        scheme = environ.get('HTTP_X_FORWARDED_PROTO')
+        if scheme:
+            environ['wsgi.url_scheme'] = scheme
+        return self.app(environ, start_response)
+
+
 db = SQLAlchemy()
 logger = logging.getLogger(__name__)
 login_manager = LoginManager()
@@ -17,6 +28,7 @@ socketio = SocketIO()
 
 def create_app(config_name):
     app = Flask(__name__)
+    app.wsgi_app = CustomProxyFix(app.wsgi_app)
     app.config.from_object(config[config_name])
 
     config[config_name].init_app(app)