1package main 2 3import ( 4 "net/http" 5 "nginx/unit" 6) 7 8func handler(w http.ResponseWriter, r *http.Request) { 9 cookie1, _ := r.Cookie("var1") 10 cookie2, _ := r.Cookie("var2") 11 12 w.Header().Set("X-Cookie-1", cookie1.Value) 13 w.Header().Set("X-Cookie-2", cookie2.Value) 14} 15 16func main() { 17 http.HandleFunc("/", handler) 18 unit.ListenAndServe(":7080", nil) 19} 20