Set base-url for HTTP requests

18 views
Skip to first unread message

bwann

unread,
Jan 3, 2017, 2:55:48 AM1/3/17
to OpenTSDB
Is there any way to set the base-url that the web UI uses?  I'm trying to proxy my OpenTSDB web UI behind Apache, e.g.  https://example.com/tsd/ -> http://internal:4242/. I can get the initial request there just fine, but OpenTSDB sends back a HTML response with a meta http-equiv header that's relative to "/" which bypasses my proxy rules and breaks things.  I.e. the UI tells the browser to to "https://example.com/#start=...."

It would be handy to be able to tell TSD to use /tsd/ instead of assuming /.

E.g. The initial http request is:
GET /tsd/q?start=1h-ago&m=sum:zfs.io.device.ops.write%7Bhost=server.example.com%7D&o=&yrange=%5B0:%5D&wxh=1500x400 HTTP/1.1

And from TSD I get:

HTTP/1.1 200 OK
Date: Tue, 03 Jan 2017 07:47:27 GMT
Server: Apache/2.4.6 (CentOS)
Location: /#start=1h-ago&m=sum:zfs.io.device.ops.write%7Bhost=server.example.com%7D&o=&yrange=%5B0:%5D&wxh=1500x400
Connection: close

<html></head><meta http-equiv="refresh" content="0; url=/#start=1h-ago&m=sum:zfs.io.device.ops.write%7Bhost=server.example.com%7D&o=&yrange=%5B0:%5D&wxh=1500x400"></head></html>

I can control the Location: header with an Apache ProxyPassReverse directive but the meta http-equiv URL always wins in my browser, redirecting it to "https://example.com/#start=1h...." instead of "https://example.com/tsd/#start=...."

--bwann

ManOLamancha

unread,
Jan 7, 2017, 7:49:13 PM1/7/17
to OpenTSDB
We don't have a good way to control it yet but there is an ancient pr https://github.com/OpenTSDB/opentsdb/pull/58 that I've started cleaning up for 2.4 and will merge with that release candidate. 
Reply all
Reply to author
Forward
0 new messages