influxdata / influxdata/influxdb-java
Incorrect URLs formed if base URL contains a path segment
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 469
- PR merge metrics
- No merged PRs in 30d
Description
(Tested with influxdb-java version 2.5)
We're using a HTTPS reverse proxy in front our influxdb instance.
The external URLs is https://scala-ci.typesafe.com/influx/write.
The URL actually generated by influxdb-java is https://scala-ci.typesafe.com/write.
I believe that changing @POST("/write") to @POST("write"), etc, in InfluxDBService.java would fix this, but haven't verified.
A workaround is to add an interceptor to fixup the URL.
OkHttpClient.Builder client = new OkHttpClient.Builder();
client.addNetworkInterceptor(chain -> {
HttpUrl.Builder fixedUrl = chain.request().url().newBuilder().encodedPath("/influx/" + chain.request().url().encodedPath().replaceFirst("/influxdb", ""));
return chain.proceed(chain.request().newBuilder().url(fixedUrl.build()).build());
});
InfluxDB influxDB = InfluxDBFactory.connect("https://scala-ci.typesafe.com/influx/", user, password, client);
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading InfluxDBService.java and tracing how its endpoint annotations combine with a base URL containing /influx. Reproduce the reported request against https://scala-ci.typesafe.com/influx/ and verify that generated URLs preserve the base path segment without requiring the interceptor workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100