Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
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
0
Merge Requests
0
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
caddy
Commits
0b513699
Commit
0b513699
authored
Nov 21, 2015
by
Matt Holt
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #356 from Luit/master
proxy: Two small websocket fixes
parents
4dbb4274
1fb66d53
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
middleware/proxy/reverseproxy.go
middleware/proxy/reverseproxy.go
+3
-2
No files found.
middleware/proxy/reverseproxy.go
View file @
0b513699
...
...
@@ -155,9 +155,9 @@ func (p *ReverseProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request, extr
if
err
!=
nil
{
return
err
}
defer
res
.
Body
.
Close
()
if
res
.
StatusCode
==
http
.
StatusSwitchingProtocols
&&
res
.
Header
.
Get
(
"Upgrade"
)
==
"websocket"
{
res
.
Body
.
Close
()
hj
,
ok
:=
rw
.
(
http
.
Hijacker
)
if
!
ok
{
return
nil
...
...
@@ -169,7 +169,7 @@ func (p *ReverseProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request, extr
}
defer
conn
.
Close
()
backendConn
,
err
:=
net
.
Dial
(
"tcp"
,
outreq
.
Host
)
backendConn
,
err
:=
net
.
Dial
(
"tcp"
,
outreq
.
URL
.
Host
)
if
err
!=
nil
{
return
err
}
...
...
@@ -182,6 +182,7 @@ func (p *ReverseProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request, extr
}()
io
.
Copy
(
conn
,
backendConn
)
// read tcp stream from backend.
}
else
{
defer
res
.
Body
.
Close
()
for
_
,
h
:=
range
hopHeaders
{
res
.
Header
.
Del
(
h
)
}
...
...
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