FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
code-server/src/node/proxy.ts at v3.11.1 · coder/code-server · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
coder
/
code-server
Public
Notifications
You must be signed in to change notification settings
Fork
6.8k
Star
79.1k
Code
Issues
143
Pull requests
7
Discussions
Actions
Projects
Security and quality
1
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
code-server
/
src
/
node
/
proxy.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
17 lines (14 loc) · 606 Bytes
Breadcrumbs
code-server
/
src
/
node
/
proxy.ts
Copy path
File metadata and controls
17 lines (14 loc) · 606 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import
proxyServer
from
"http-proxy"
import
{
HttpCode
}
from
"../common/http"
export
const
proxy
=
proxyServer
.
createProxyServer
(
{
}
)
proxy
.
on
(
"error"
,
(
error
,
_
,
res
)
=>
{
res
.
writeHead
(
HttpCode
.
ServerError
)
res
.
end
(
error
.
message
)
}
)
// Intercept the response to rewrite absolute redirects against the base path.
// Is disabled when the request has no base path which means /absproxy is in use.
proxy
.
on
(
"proxyRes"
,
(
res
,
req
)
=>
{
if
(
res
.
headers
.
location
&&
res
.
headers
.
location
.
startsWith
(
"/"
)
&&
(
req
as
any
)
.
base
)
{
res
.
headers
.
location
=
(
req
as
any
)
.
base
+
res
.
headers
.
location
}
}
)
Back
|
FazBrowse Home
|
New Git URL