FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
echo/vhost.go at master · labstack/echo · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
labstack
/
echo
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
2.4k
Star
32.7k
Code
Issues
8
Pull requests
20
Discussions
Actions
Projects
Wiki
Security and quality
2
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
echo
/
vhost.go
Copy path
More file actions
More file actions
Latest commit
History
History
History
20 lines (17 loc) · 604 Bytes
Breadcrumbs
echo
/
vhost.go
Copy path
File metadata and controls
20 lines (17 loc) · 604 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
18
19
20
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: © 2015 LabStack LLC and Echo contributors
package
echo
import
"net/http"
// NewVirtualHostHandler creates instance of Echo that routes requests to given virtual hosts
// when hosts in request does not exist in given map the request is served by returned Echo instance.
func
NewVirtualHostHandler
(
vhosts
map
[
string
]
*
Echo
)
*
Echo
{
e
:=
New
()
e
.
serveHTTPFunc
=
func
(
w
http.
ResponseWriter
,
r
*
http.
Request
) {
if
vh
,
ok
:=
vhosts
[
r
.
Host
];
ok
{
vh
.
ServeHTTP
(
w
,
r
)
return
}
e
.
serveHTTP
(
w
,
r
)
// unknown host in request
}
return
e
}
Back
|
FazBrowse Home
|
New Git URL