Fix prefix URL routing to handle CIDR notation with slashes
- Use wildcard route pattern for /prefix/* endpoints - Extract prefix parameter using chi.URLParam(r, "*") - Fixes 400 error when accessing /prefix/x.x.x.x/32 directly
This commit is contained in:
@@ -28,7 +28,7 @@ func (s *Server) setupRoutes() {
|
||||
|
||||
// AS and prefix detail pages
|
||||
r.Get("/as/{asn}", s.handleASDetail())
|
||||
r.Get("/prefix/{prefix}", s.handlePrefixDetail())
|
||||
r.Get("/prefix/*", s.handlePrefixDetail())
|
||||
r.Get("/prefixlength/{length}", s.handlePrefixLength())
|
||||
r.Get("/prefixlength6/{length}", s.handlePrefixLength6())
|
||||
|
||||
@@ -45,7 +45,7 @@ func (s *Server) setupRoutes() {
|
||||
r.Get("/stats", s.handleStats())
|
||||
r.Get("/ip/{ip}", s.handleIPLookup())
|
||||
r.Get("/as/{asn}", s.handleASDetailJSON())
|
||||
r.Get("/prefix/{prefix}", s.handlePrefixDetailJSON())
|
||||
r.Get("/prefix/*", s.handlePrefixDetailJSON())
|
||||
})
|
||||
|
||||
s.router = r
|
||||
|
||||
Reference in New Issue
Block a user