Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
matrix-media-repo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
matrix-media-repo
Commits
072e5246
Unverified
Commit
072e5246
authored
5 years ago
by
Alexander Olofsson
Browse files
Options
Downloads
Patches
Plain Diff
Add config flag to ignore XFH header
Fixes #202
parent
771e3fbd
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/webserver/route_handler.go
+1
-1
1 addition, 1 deletion
api/webserver/route_handler.go
common/config/config.go
+10
-8
10 additions, 8 deletions
common/config/config.go
with
11 additions
and
9 deletions
api/webserver/route_handler.go
+
1
−
1
View file @
072e5246
...
@@ -31,7 +31,7 @@ type handler struct {
...
@@ -31,7 +31,7 @@ type handler struct {
func
(
h
handler
)
ServeHTTP
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
func
(
h
handler
)
ServeHTTP
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
isUsingForwardedHost
:=
false
isUsingForwardedHost
:=
false
if
r
.
Header
.
Get
(
"X-Forwarded-Host"
)
!=
""
{
if
r
.
Header
.
Get
(
"X-Forwarded-Host"
)
!=
""
&&
!
config
.
Get
()
.
General
.
IgnoreForwardedHost
{
r
.
Host
=
r
.
Header
.
Get
(
"X-Forwarded-Host"
)
r
.
Host
=
r
.
Header
.
Get
(
"X-Forwarded-Host"
)
isUsingForwardedHost
=
true
isUsingForwardedHost
=
true
}
}
...
...
This diff is collapsed.
Click to expand it.
common/config/config.go
+
10
−
8
View file @
072e5246
...
@@ -23,10 +23,11 @@ type HomeserverConfig struct {
...
@@ -23,10 +23,11 @@ type HomeserverConfig struct {
}
}
type
GeneralConfig
struct
{
type
GeneralConfig
struct
{
BindAddress
string
`yaml:"bindAddress"`
BindAddress
string
`yaml:"bindAddress"`
Port
int
`yaml:"port"`
Port
int
`yaml:"port"`
LogDirectory
string
`yaml:"logDirectory"`
LogDirectory
string
`yaml:"logDirectory"`
TrustAnyForward
bool
`yaml:"trustAnyForwardedAddress"`
TrustAnyForward
bool
`yaml:"trustAnyForwardedAddress"`
IgnoreForwardedHost
bool
`yaml:"ignoreForwardedHost"`
}
}
type
DbPoolConfig
struct
{
type
DbPoolConfig
struct
{
...
@@ -219,10 +220,11 @@ func Get() *MediaRepoConfig {
...
@@ -219,10 +220,11 @@ func Get() *MediaRepoConfig {
func
NewDefaultConfig
()
*
MediaRepoConfig
{
func
NewDefaultConfig
()
*
MediaRepoConfig
{
return
&
MediaRepoConfig
{
return
&
MediaRepoConfig
{
General
:
&
GeneralConfig
{
General
:
&
GeneralConfig
{
BindAddress
:
"127.0.0.1"
,
BindAddress
:
"127.0.0.1"
,
Port
:
8000
,
Port
:
8000
,
LogDirectory
:
"logs"
,
LogDirectory
:
"logs"
,
TrustAnyForward
:
false
,
TrustAnyForward
:
false
,
IgnoreForwardedHost
:
false
,
},
},
Database
:
&
DatabaseConfig
{
Database
:
&
DatabaseConfig
{
Postgres
:
"postgres://your_username:your_password@localhost/database_name?sslmode=disable"
,
Postgres
:
"postgres://your_username:your_password@localhost/database_name?sslmode=disable"
,
...
...
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