Commit ea93cbf9 authored by leitao.zhang's avatar leitao.zhang

允许所有页面嵌套,所有服务均返回健康

parent 6870f98a
......@@ -2,33 +2,48 @@ workspace:
path: src/gitlab.wodcloud.com/apaas/apaas-meshproxy
clone:
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
pipeline:
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
environment:
- GOPROXY=https://goproxy.cn,direct
main: src
binary: proxy
volumes:
# - /cache/gopath/pkg:/drone/pkg
- /data/cache/gopath/pkg:/drone/pkg
docker:
docker-dev:
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:
- /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"
registry: hub.gy.wodcloud.com
registry: registry.cn-qingdao.aliyuncs.com
secrets:
- source: REGISTRY_USER_GUIZHOU
- source: REGISTRY_USER_ALIYUN
target: REGISTRY_USER
- source: REGISTRY_PASSWORD_GUIZHOU
- source: REGISTRY_PASSWORD_ALIYUN
target: REGISTRY_PASSWORD
when:
branch: [master]
......@@ -12,7 +12,6 @@ import (
"github.com/vulcand/oxy/testutils"
"gitlab.wodcloud.com/apaas/apaas-meshproxy/src/model"
"gitlab.wodcloud.com/apaas/apaas-meshproxy/src/service"
"gitlab.wodcloud.com/apaas/apaas-meshproxy/src/tools"
"io/ioutil"
"log"
"net/http"
......@@ -248,39 +247,44 @@ func getHost(httpurl string) (path string) {
func HealthCheck(c *gin.Context) {
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.Data = "success"
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
}
......@@ -50,7 +50,7 @@ func Options(c *gin.Context) {
// and resource access headers.
func Secure(c *gin.Context) {
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-XSS-Protection", "1; mode=block")
if c.Request.TLS != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment