Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
apaas-meshproxy
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gzga-jzapi
apaas-meshproxy
Commits
ea93cbf9
Commit
ea93cbf9
authored
Dec 22, 2020
by
leitao.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
允许所有页面嵌套,所有服务均返回健康
parent
6870f98a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
46 deletions
+65
-46
.beagle.yml
.beagle.yml
+26
-11
src/handler/proxyhandler.go
src/handler/proxyhandler.go
+38
-34
src/router/middleware/header/header.go
src/router/middleware/header/header.go
+1
-1
No files found.
.beagle.yml
View file @
ea93cbf9
...
@@ -2,33 +2,48 @@ workspace:
...
@@ -2,33 +2,48 @@ workspace:
path
:
src/gitlab.wodcloud.com/apaas/apaas-meshproxy
path
:
src/gitlab.wodcloud.com/apaas/apaas-meshproxy
clone
:
clone
:
git
:
git
:
image
:
registry.cn-qingdao.aliyuncs.com/wod
/devops-git:1
.0
image
:
registry.cn-qingdao.aliyuncs.com/wod
-devops/git:1.5
.0
dns
:
223.5.5.5
dns
:
223.5.5.5
pipeline
:
pipeline
:
go
:
go
:
image
:
registry.cn-qingdao.aliyuncs.com/wod
/devops-go:1.14.4
-stretch
image
:
registry.cn-qingdao.aliyuncs.com/wod
-devops/go:1.13.1
-stretch
dns
:
223.5.5.5
dns
:
223.5.5.5
environment
:
environment
:
-
GOPROXY=https://goproxy.cn,direct
-
GOPROXY=https://goproxy.cn,direct
main
:
src
main
:
src
binary
:
proxy
binary
:
proxy
volumes
:
volumes
:
# - /cache/gopath/pkg:/drone/pkg
-
/data/cache/gopath/pkg:/drone/pkg
-
/data/cache/gopath/pkg:/drone/pkg
docker-dev
:
docker
:
dns
:
223.5.5.5
dns
:
223.5.5.5
image
:
registry.cn-qingdao.aliyuncs.com/wod/devops-docker:1.0
image
:
registry.cn-qingdao.aliyuncs.com/wod-devops/docker:1.0
volumes
:
-
/var/run/docker.sock:/var/run/docker.sock
base
:
registry.cn-qingdao.aliyuncs.com/wod/alpine-glibc:3.8
repo
:
wod/apaas-meshproxy
version
:
v3.0.0
channel
:
alpha
registry
:
registry.cn-qingdao.aliyuncs.com
secrets
:
-
source
:
REGISTRY_USER_ALIYUN
target
:
REGISTRY_USER
-
source
:
REGISTRY_PASSWORD_ALIYUN
target
:
REGISTRY_PASSWORD
when
:
branch
:
[
dev
]
docker-master
:
dns
:
223.5.5.5
image
:
registry.cn-qingdao.aliyuncs.com/wod-devops/docker:1.0
volumes
:
volumes
:
-
/var/run/docker.sock:/var/run/docker.sock
-
/var/run/docker.sock:/var/run/docker.sock
base
:
registry.cn-qingdao.aliyuncs.com/wod/alpine-glibc:3.8
base
:
registry.cn-qingdao.aliyuncs.com/wod/alpine-glibc:3.8
repo
:
wod/apaas-meshproxy
repo
:
wod/apaas-meshproxy
version
:
"
v3.0.0"
version
:
"
v3.0.0"
registry
:
hub.gy.wodcloud
.com
registry
:
registry.cn-qingdao.aliyuncs
.com
secrets
:
secrets
:
-
source
:
REGISTRY_USER_
GUIZHOU
-
source
:
REGISTRY_USER_
ALIYUN
target
:
REGISTRY_USER
target
:
REGISTRY_USER
-
source
:
REGISTRY_PASSWORD_
GUIZHOU
-
source
:
REGISTRY_PASSWORD_
ALIYUN
target
:
REGISTRY_PASSWORD
target
:
REGISTRY_PASSWORD
when
:
branch
:
[
master
]
src/handler/proxyhandler.go
View file @
ea93cbf9
...
@@ -12,7 +12,6 @@ import (
...
@@ -12,7 +12,6 @@ import (
"github.com/vulcand/oxy/testutils"
"github.com/vulcand/oxy/testutils"
"gitlab.wodcloud.com/apaas/apaas-meshproxy/src/model"
"gitlab.wodcloud.com/apaas/apaas-meshproxy/src/model"
"gitlab.wodcloud.com/apaas/apaas-meshproxy/src/service"
"gitlab.wodcloud.com/apaas/apaas-meshproxy/src/service"
"gitlab.wodcloud.com/apaas/apaas-meshproxy/src/tools"
"io/ioutil"
"io/ioutil"
"log"
"log"
"net/http"
"net/http"
...
@@ -248,39 +247,44 @@ func getHost(httpurl string) (path string) {
...
@@ -248,39 +247,44 @@ func getHost(httpurl string) (path string) {
func
HealthCheck
(
c
*
gin
.
Context
)
{
func
HealthCheck
(
c
*
gin
.
Context
)
{
res
:=
model
.
WebRes
{}
res
:=
model
.
WebRes
{}
apiId
:=
c
.
Param
(
"apiid"
)
proxyData
,
err
:=
service
.
GetReqPath
(
apiId
)
if
err
!=
nil
{
res
.
Data
=
err
.
Error
()
c
.
JSON
(
500
,
res
)
return
}
var
requstMethod
string
//获取真实地址1GET 2POST 3 PUT 4 DELETE
if
proxyData
.
ReqType
==
1
{
requstMethod
=
"GET"
}
else
if
proxyData
.
ReqType
==
2
{
requstMethod
=
"POST"
}
else
if
proxyData
.
ReqType
==
3
{
requstMethod
=
"PUT"
}
else
if
proxyData
.
ReqType
==
4
{
requstMethod
=
"DELETE"
}
header
:=
make
(
map
[
string
]
string
,
0
)
resp
,
err
:=
tools
.
ProxySendRes
(
c
.
Request
,
requstMethod
,
proxyData
.
ReqUrl
,
""
,
header
)
if
err
!=
nil
{
res
.
Data
=
err
.
Error
()
c
.
JSON
(
500
,
res
)
return
}
fmt
.
Println
(
resp
)
if
resp
.
StatusCode
<
400
{
res
.
Data
=
"success"
}
else
{
res
.
Data
=
"fail"
}
res
.
Success
=
1
res
.
Success
=
1
//请求真实地址根据返回状态码判断是否服务可用
res
.
Data
=
"success"
c
.
JSON
(
200
,
res
)
c
.
JSON
(
200
,
res
)
return
//
//apiId := c.Param("apiid")
//proxyData, err := service.GetReqPath(apiId)
//if err != nil {
// res.Data = err.Error()
// c.JSON(500, res)
// return
//}
//var requstMethod string
////获取真实地址1GET 2POST 3 PUT 4 DELETE
//if proxyData.ReqType == 1 {
// requstMethod = "GET"
//} else if proxyData.ReqType == 2 {
// requstMethod = "POST"
//} else if proxyData.ReqType == 3 {
// requstMethod = "PUT"
//} else if proxyData.ReqType == 4 {
// requstMethod = "DELETE"
//}
//header := make(map[string]string, 0)
//resp, err := tools.ProxySendRes(c.Request, requstMethod, proxyData.ReqUrl, "", header)
//if err != nil {
// res.Data = err.Error()
// c.JSON(500, res)
// return
//}
//fmt.Println(resp)
//if resp.StatusCode < 400 {
// res.Data = "success"
//} else {
// res.Data = "fail"
//}
//res.Success = 1
////请求真实地址根据返回状态码判断是否服务可用
//c.JSON(200, res)
//return
}
}
src/router/middleware/header/header.go
View file @
ea93cbf9
...
@@ -50,7 +50,7 @@ func Options(c *gin.Context) {
...
@@ -50,7 +50,7 @@ func Options(c *gin.Context) {
// and resource access headers.
// and resource access headers.
func
Secure
(
c
*
gin
.
Context
)
{
func
Secure
(
c
*
gin
.
Context
)
{
c
.
Header
(
"Access-Control-Allow-Origin"
,
"*"
)
c
.
Header
(
"Access-Control-Allow-Origin"
,
"*"
)
c
.
Header
(
"X-Frame-Options"
,
"
DENY
"
)
c
.
Header
(
"X-Frame-Options"
,
"
ALLOWALL
"
)
c
.
Header
(
"X-Content-Type-Options"
,
"nosniff"
)
c
.
Header
(
"X-Content-Type-Options"
,
"nosniff"
)
c
.
Header
(
"X-XSS-Protection"
,
"1; mode=block"
)
c
.
Header
(
"X-XSS-Protection"
,
"1; mode=block"
)
if
c
.
Request
.
TLS
!=
nil
{
if
c
.
Request
.
TLS
!=
nil
{
...
...
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