Skip to content

Commit

Permalink
允许跨域请求
Browse files Browse the repository at this point in the history
  • Loading branch information
fcwys committed May 28, 2022
1 parent 5ca6036 commit 220d5db
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ var serverCmd = &cobra.Command{
//参数方式查询
ec.GET("/", func(c echo.Context) error {
//设置响应头信息
c.Response().Header().Add("Access-Control-Allow-Origin", "*")
c.Response().Header().Add("Server", "nginx/1.22.0")
ip := c.QueryParam("ip")
cname := ""
Expand Down Expand Up @@ -118,6 +119,7 @@ var serverCmd = &cobra.Command{
//路径方式查询
ec.GET("/:ip", func(c echo.Context) error {
//设置响应头信息
c.Response().Header().Add("Access-Control-Allow-Origin", "*")
c.Response().Header().Add("Server", "nginx/1.22.0")
ip := c.Param("ip")
cname := ""
Expand Down

0 comments on commit 220d5db

Please sign in to comment.