buro9 / microcosm

Front end for Microcosm, a Go web server that serves the static files, templates and performs API calls.
GNU Affero General Public License v3.0
11 stars 3 forks source link

Strip port number for Host in ApiRootFromRequest() before API lookup #57

Closed yemble closed 2 years ago

yemble commented 7 years ago

Separating this from my prometheus branch:

Port number suffix in req.Host trips up the API lookup, so remove it before proceeding.

Prometheus always appends the port number when it calls for metrics:

web_1 | 2017/03/16 06:14:39 [..] "GET http://dev.microcosmcc.com:80/metrics HTTP/1.1" from 172.18.0.5 - 200 1132B in 6.216271ms

yemble commented 7 years ago

It just occurred to me that putting the /metrics handler in a separate Group so it doesn't get the ApiRoot middleware works around the problem!