add important headers
This commit is contained in:
parent
ff6d157e6b
commit
2f24020263
|
@ -1,18 +1,57 @@
|
|||
package global
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"arimelody-web/colour"
|
||||
"arimelody-web/colour"
|
||||
)
|
||||
|
||||
var PoweredByStrings = []string{
|
||||
"nerd rage",
|
||||
"estrogen",
|
||||
"your mother",
|
||||
"awesome powers beyond comprehension",
|
||||
"jared",
|
||||
"the weight of my sins",
|
||||
"the arc reactor",
|
||||
"AA batteries",
|
||||
"15 euro solar panel from ebay",
|
||||
"magnets, how do they work",
|
||||
"a fax machine",
|
||||
"dell optiplex",
|
||||
"a trans girl's nintendo wii",
|
||||
"BASS",
|
||||
"electricity, duh",
|
||||
"seven hamsters in a big wheel",
|
||||
"girls",
|
||||
"mzungu hosting",
|
||||
"golang",
|
||||
"the state of the world right now",
|
||||
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)",
|
||||
"the good folks at aperture science",
|
||||
"free2play CDs",
|
||||
"aridoodle",
|
||||
"the love of creating",
|
||||
"not for the sake of art; not for the sake of money; we like painting naked people",
|
||||
"30 billion dollars in VC funding",
|
||||
}
|
||||
|
||||
func DefaultHeaders(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Add("Server", "arimelody.me")
|
||||
w.Header().Add("Cache-Control", "max-age=2592000")
|
||||
w.Header().Add("Do-Not-Stab", "1")
|
||||
w.Header().Add("X-Clacks-Overhead", "GNU Terry Pratchett")
|
||||
w.Header().Add("X-Hacker", "spare me please")
|
||||
w.Header().Add("X-Robots-TXT", "'; DROP TABLE pages;")
|
||||
w.Header().Add("X-Thinking-With", "Portals")
|
||||
w.Header().Add(
|
||||
"X-Powered-By",
|
||||
PoweredByStrings[rand.Intn(len(PoweredByStrings))],
|
||||
)
|
||||
next.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
|
|
5
main.go
5
main.go
|
@ -67,7 +67,10 @@ func main() {
|
|||
// start the web server!
|
||||
mux := createServeMux()
|
||||
fmt.Printf("Now serving at http://127.0.0.1:%d\n", global.Config.Port)
|
||||
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", global.Config.Port), global.HTTPLog(mux)))
|
||||
log.Fatal(
|
||||
http.ListenAndServe(fmt.Sprintf(":%d", global.Config.Port),
|
||||
global.HTTPLog(global.DefaultHeaders(mux)),
|
||||
))
|
||||
}
|
||||
|
||||
func createServeMux() *http.ServeMux {
|
||||
|
|
Loading…
Reference in a new issue