Dinamic path works fine, but if i try to serve static file with
FileHandler func, i'm always get 404 error.
func main() {
r := mux.NewRouter()
r.HandleFunc("/", HomeHandler)
r.HandleFunc("/favicon.ico", FileHandler)
r.HandleFunc("/sitemap.txt", FileHandler)
r.HandleFunc("/robots.txt", FileHandler)
r.HandleFunc("/images", FileHandler)
r.HandleFunc("/css", FileHandler)
r.HandleFunc("/projects/{category}", ProjectsHandler)
r.HandleFunc("/projects/{category}/{project}", ProjectHandler)
e := http.ListenAndServe(":8080", r)
if e != nil {
println(e.Error())
}
}
When i get /images i get text/html, then i get /images/logo.png i get 404 error.
What i'm missing?
--
Vasiliy Tolstov,
Clodo.ru
e-mail: v.to...@selfip.ru
jabber: va...@selfip.ru
When i get /images i get text/html, then i get /images/logo.png i get 404 error.
What i'm missing?
No, in this case when get /images/ all works, but if /images/logo.png not.
Hmm. How can i deal with this and with r.StrictSlash(true) ?
Or i need new router?
--
Vasiliy Tolstov,
Clodo.ru
e-mail: v.to...@selfip.ru
jbv abber: va...@selfip.ru
v
Thanks for quick fix!
>
--
Vasiliy Tolstov,
Clodo.ru
e-mail: v.to...@selfip.ru
jabber: va...@selfip.ru
Hmm , some error not solved.
When StrictSlah(true) i get net::ERR_TOO_MANY_REDIRECTS in chromium
and to path static/logo.png in first reload add slash
(/static/logo.png/) and after second refresh slash removed
(/static/logo.png) but error stil exists.
--
Vasiliy Tolstov,
Clodo.ru
e-mail: v.to...@selfip.ru
jabber: va...@selfip.ru
func main() {
r := mux.NewRouter()
// r.StrictSlash(true)
r.HandleFunc("/", HomeHandler)
r.HandleFunc("/favicon.ico", FileHandler)
r.HandleFunc("/sitemap.txt", FileHandler)
r.HandleFunc("/robots.txt", FileHandler)
r.PathPrefix("/static/").Handler(http.StripPrefix("/static/",
http.FileServer(http.Dir("static/"))))
r.HandleFunc("/projects/{category}", ProjectsHandler)
r.HandleFunc("/projects/{category}/{project}", ProjectHandler)
r.HandleFunc("/login/{method}", LoginHandler)
http.Handle("/", r)
e := http.ListenAndServe(":8080", r)
if e != nil {
println(e.Error())
}
}
i'm update package via go get -u
Nothing. I'm go to src/ hg pull && gh update
go install -v inside mux dir
after that i get mux.a pkg.
after that i go to my project and do
go clean
go build
but i still have error.. (hg log says that changes to mux apllied)