Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-workhorse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-workhorse
Commits
985651fe
Commit
985651fe
authored
Dec 17, 2015
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expand comment about redirect loop
parent
6d79151e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
upstream.go
upstream.go
+8
-4
No files found.
upstream.go
View file @
985651fe
...
@@ -64,20 +64,24 @@ type gitRequest struct {
...
@@ -64,20 +64,24 @@ type gitRequest struct {
}
}
func
newUpstream
(
authBackend
string
,
authTransport
http
.
RoundTripper
)
*
upstream
{
func
newUpstream
(
authBackend
string
,
authTransport
http
.
RoundTripper
)
*
upstream
{
u
,
err
:=
url
.
Parse
(
authBackend
)
gitlabURL
,
err
:=
url
.
Parse
(
authBackend
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Fatalln
(
err
)
log
.
Fatalln
(
err
)
}
}
relativeURLRoot
:=
u
.
Path
relativeURLRoot
:=
gitlabURL
.
Path
if
!
strings
.
HasSuffix
(
relativeURLRoot
,
"/"
)
{
if
!
strings
.
HasSuffix
(
relativeURLRoot
,
"/"
)
{
relativeURLRoot
+=
"/"
relativeURLRoot
+=
"/"
}
}
u
.
Path
=
""
// Would cause redirect loop in ReverseProxy
// If the relative URL is '/foobar' and we tell httputil.ReverseProxy to proxy
// to 'http://example.com/foobar' then we get a redirect loop, so we clear the
// Path field here.
gitlabURL
.
Path
=
""
up
:=
&
upstream
{
up
:=
&
upstream
{
authBackend
:
authBackend
,
authBackend
:
authBackend
,
httpClient
:
&
http
.
Client
{
Transport
:
authTransport
},
httpClient
:
&
http
.
Client
{
Transport
:
authTransport
},
httpProxy
:
httputil
.
NewSingleHostReverseProxy
(
u
),
httpProxy
:
httputil
.
NewSingleHostReverseProxy
(
gitlabURL
),
relativeURLRoot
:
relativeURLRoot
,
relativeURLRoot
:
relativeURLRoot
,
}
}
up
.
httpProxy
.
Transport
=
authTransport
up
.
httpProxy
.
Transport
=
authTransport
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment