Closed tunahanertekin closed 1 year ago
Hi. Your path need to end with /, then it will work correctly. You should add redirect on your proxy to path that always ends with /. That's how it's done in neko-rooms.
Yeah I've just noticed that, thanks. I was also able to change the application route from http.go
by adding /xyz
prefix before every route. There was just one issue I was faced with, in file server route. I will share the solution I found for that if anyone will have the same struggle and close this issue.
fs := http.FileServer(http.Dir(conf.Static))
router.Get("/xyz/*", func(w http.ResponseWriter, r *http.Request) {
// *** should manipulate path like this to give OS the right file path
r.URL.Path = r.URL.Path[4:] // 4 is because len("/xyz") = 4 for example
if _, err := os.Stat(conf.Static + r.URL.Path); !os.IsNotExist(err) {
fs.ServeHTTP(w, r)
} else {
http.NotFound(w, r)
}
})
Or it could be done using StripPrefix so i made PR. https://github.com/m1k1o/neko/pull/199
Hi again,
Neko is started at URL
ip:port
by default. I want to change this URL toip:port/my-route
. Is there a trick to change application root in Neko using arguments etc.?I tried to copy client files (
src/dist
) to/var/www/my-route
and web application is started atip:port/my-route
but it couldn't connect to websocket since it tried to connect tows-ip:ws-port/my-route/ws
, so it was required to change websocket endpoint too but couldn't find the right spot so far. Thanks in advance.