Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nopaque
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Looking for advice? Join the
Matrix channel for GitLab users in Bielefeld
!
Show more breadcrumbs
SFB 1288 - INF
nopaque
Commits
94d99862
Commit
94d99862
authored
4 years ago
by
Patrick Jentsch
Browse files
Options
Downloads
Patches
Plain Diff
Use werkzeugs pre implemented ProxyFix middleware
parent
814821a2
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/__init__.py
+0
-12
0 additions, 12 deletions
app/__init__.py
config.py
+8
-1
8 additions, 1 deletion
config.py
with
8 additions
and
13 deletions
app/__init__.py
+
0
−
12
View file @
94d99862
...
...
@@ -7,17 +7,6 @@ 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
()
...
...
@@ -28,7 +17,6 @@ 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
)
...
...
This diff is collapsed.
Click to expand it.
config.py
+
8
−
1
View file @
94d99862
from
werkzeug.middleware.proxy_fix
import
ProxyFix
import
os
import
logging
...
...
@@ -33,7 +34,13 @@ class Config:
@staticmethod
def
init_app
(
app
):
pass
proxy_fix_kwargs
=
{
'
x_for
'
:
1
,
'
x_host
'
:
1
,
'
x_port
'
:
1
,
'
x_proto
'
:
1
,
}
app
.
wsgi_app
=
ProxyFix
(
app
.
wsgi_app
,
**
proxy_fix_kwargs
)
class
DevelopmentConfig
(
Config
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment