简体   繁体   中英

Golang iris-web. Get HTTP referer and useragent

lang and trying to use a framework called iris-web.

i wanted to know how to get the http referrer and user-agent properly..

I've been through the documentation pdf. No clear explanation..

Any help will be deeply appreciated.

As in regular Go http:

request.Header.Get("User-Agent")
request.Header.Get("Referer")
import "github.com/kataras/iris"
// [...]

func(ctx iris.Context){
  uag:= ctx.GetHeader("User-Agent")
  ref:= ctx.GetHeader("Referer")
}

Iris provides features that other frameworks doesn't have while in the same time it's faster. Iris ,as github project is more active than others. There is no reason to suggest other lower frameworks when the user asks for Iris answer.

@Sergey Lanzman What's the problem with Iris?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM