summaryrefslogtreecommitdiffstats
path: root/api/api.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-04-01 11:48:19 -0400
committerChristopher Speller <crspeller@gmail.com>2016-04-01 11:51:17 -0400
commit7e9c7ce60a90f3628888f178c27642561643abaa (patch)
tree5f4ec04e9d7d62213d8daac7ddafe8e864a5feff /api/api.go
parent36f611fac48536f26770357de8d5b6767bd46d2f (diff)
downloadchat-7e9c7ce60a90f3628888f178c27642561643abaa.tar.gz
chat-7e9c7ce60a90f3628888f178c27642561643abaa.tar.bz2
chat-7e9c7ce60a90f3628888f178c27642561643abaa.zip
Visiting invalid URLs and bad APIs causes redirect to error page
Diffstat (limited to 'api/api.go')
-rw-r--r--api/api.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/api/api.go b/api/api.go
index 20f77e558..476047877 100644
--- a/api/api.go
+++ b/api/api.go
@@ -27,6 +27,8 @@ func InitApi() {
InitWebhook(r)
InitPreference(r)
InitLicense(r)
+ // 404 on any api route before web.go has a chance to serve it
+ Srv.Router.Handle("/api/{anything:.*}", http.HandlerFunc(Handle404))
utils.InitHTML()
}