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 3a5501c commit aef708d
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 @@ -69,6 +69,7 @@ var serverCmd = &cobra.Command{
//参数方式查询
ec.GET("/", func(c *gin.Context) {
//设置响应头信息
c.Header("Access-Control-Allow-Origin", "*")
c.Header("Server", "nginx/1.22.0")
ip := c.Query("ip")
cname := ""
Expand Down Expand Up @@ -124,6 +125,7 @@ var serverCmd = &cobra.Command{
//路径查询方式
ec.GET("/:ip", func(c *gin.Context) {
//设置响应头信息
c.Header("Access-Control-Allow-Origin", "*")
c.Header("Server", "nginx/1.22.0")
ip := c.Param("ip")
cname := ""
Expand Down

0 comments on commit aef708d

Please sign in to comment.