Set default NotFound handler.
This commit is contained in:
parent
3f79eb5b08
commit
dab675474a
@ -8,6 +8,7 @@ import (
|
|||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
nethttp "net/http"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
@ -88,7 +89,9 @@ func main() {
|
|||||||
*keepFileForHours, *limitStorage, *limitFileSize)
|
*keepFileForHours, *limitStorage, *limitFileSize)
|
||||||
srv := http.NewHttpServer()
|
srv := http.NewHttpServer()
|
||||||
|
|
||||||
srv.SetNotFoundHandler(http.NotFound)
|
srv.SetNotFoundHandler(func(w nethttp.ResponseWriter, r *nethttp.Request) {
|
||||||
|
http.Error(w, r, nethttp.StatusNotFound, "")
|
||||||
|
})
|
||||||
|
|
||||||
srv.ServeStatic("/assets/*filepath", hand.AssetsFS())
|
srv.ServeStatic("/assets/*filepath", hand.AssetsFS())
|
||||||
srv.GET("/robots.txt", http.RobotsTxt)
|
srv.GET("/robots.txt", http.RobotsTxt)
|
||||||
|
Loading…
Reference in New Issue
Block a user