influxdata / influxdb-php

influxdb-php: A PHP Client for InfluxDB, a time series database
http://influxdb.com
MIT License
432 stars 125 forks source link

Can't omit port if running influxdb behind reverse proxy #163

Closed jrbecart closed 3 years ago

jrbecart commented 3 years ago

I am looking to omit the port number as I am running influx with a reverse proxy.

With an empty port value I got: "https://myhost/influxdb:0" but I want "https://myhost/influxdb"

An easy fix in Client.php will be:

// the the base URI
if(empty($this->port))
  $this->baseURI = sprintf('%s://%s', $this->scheme, $this->host);
else
  $this->baseURI = sprintf('%s://%s:%d', $this->scheme, $this->host, $this->port);

Let me know if it's possible. Regards,

jrbecart commented 3 years ago

Sorry this change is not needed, adding a / at the end seems to do the job: https://myhost/influxdb/:0