2024-01-11 09:08:11 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"net/http"
|
|
|
|
|
2024-01-11 14:42:33 +01:00
|
|
|
"git.jmbit.de/jmb/www-jmbit-de/public"
|
2024-01-11 09:08:11 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2024-01-11 14:42:33 +01:00
|
|
|
// Register a custom handler
|
|
|
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
|
|
|
// Specify the file path you want to block
|
|
|
|
blockFilePath := "/public.go"
|
|
|
|
|
|
|
|
// Check if the requested path matches the blocked file path
|
|
|
|
if r.URL.Path == blockFilePath {
|
|
|
|
// Return a 404 Not Found error
|
|
|
|
http.NotFound(w, r)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// For other paths, serve the files using the file server
|
|
|
|
http.FileServer(http.FS(public.HtmlFS)).ServeHTTP(w, r)
|
|
|
|
})
|
2024-01-11 09:08:11 +01:00
|
|
|
|
2024-01-11 14:42:33 +01:00
|
|
|
// Start the HTTP server on port 80
|
|
|
|
err := http.ListenAndServe(":80", nil)
|
2024-01-11 09:08:11 +01:00
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|