Skip to content

Instantly share code, notes, and snippets.

@antonyh
Last active April 30, 2020 11:51
Show Gist options
  • Save antonyh/ef654bd481d5f0f0612346fe68e11867 to your computer and use it in GitHub Desktop.
Save antonyh/ef654bd481d5f0f0612346fe68e11867 to your computer and use it in GitHub Desktop.
Simple HTTP server in Golang to echo back request URI for debugging other things (such as HTTPd rewrite rules)
package main
import (
"fmt"
"log"
"net/http"
)
func main() {
http.HandleFunc("/", func (w http.ResponseWriter, r *http.Request) {
log.Printf(r.RequestURI)
fmt.Fprintf(w, "%s\n", r.RequestURI)
})
http.ListenAndServe(":8080", nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment