mirror of
https://gitee.com/lauix/HFish
synced 2025-05-12 04:48:01 +08:00
~ 上钩列表支持批量删除 ~ 上钩列表长度展示 ~ 上钩列表支持集群筛选 ~ 集群页面支持删除 ~ 改用 IPIP 本地库获取地理信息 ~ 支持 WebHook Api 通知 ~ 提供获取上钩列表 API ~ WEB,暗网蜜罐 API 移到各种服务上,抛开 Admin ~ 修复暗网蜜罐使用问题 ~ 修复集群取 IP 错误问题 ~ SSH 高交互支持
24 lines
677 B
Go
24 lines
677 B
Go
package cors
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"net/http"
|
|
)
|
|
|
|
// 解决跨域问题
|
|
func Cors() gin.HandlerFunc {
|
|
return func(c *gin.Context) {
|
|
method := c.Request.Method
|
|
|
|
c.Header("Access-Control-Allow-Origin", "*")
|
|
c.Header("Access-Control-Allow-Headers", "Content-Type,AccessToken,X-CSRF-Token, Authorization, Token")
|
|
c.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS")
|
|
c.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type")
|
|
c.Header("Access-Control-Allow-Credentials", "true")
|
|
if method == "OPTIONS" {
|
|
c.AbortWithStatus(http.StatusNoContent)
|
|
}
|
|
c.Next()
|
|
}
|
|
}
|