Naphat Amundsen
Naphat Amundsen

Reputation: 1623

Quarkus rest client not respecting -Dhttp.proxyHost -Dhttp.proxyPort proxy options

I want to specify my Quarkus application (v2.8.3.Final) to use an HTTP proxy without changing any code

To attempt this I pass the -Dhttp.proxyHost and -Dhttp.proxyPort options to the terminal, like this:

./mvnw quarkus:dev -Dquarkus.http.host=0.0.0.0 -Dquarkus.http.port=9000 -Ddebug=9001 -Dhttp.proxyHost=localhost -Dhttp.proxyPort=6969

Comparing the working quarkus app and the problematic one

To compare the working quarkus application (A), and the other (B) I have implemented a resource that sends a request to http://google.com

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.core.MediaType;

   .
   .
   .

    @GET
    @Path("/google")
    @Produces(MediaType.TEXT_PLAIN)
    public String google() {
        Client client = ClientBuilder.newClient();
        return client.target("http://www.google.com")
                     .request(MediaType.TEXT_PLAIN)
                     .get()
                     .readEntity(String.class);
    }

and I have ensured that the Quarkus versions are the same. Here is a minimal snippet from pom.xml

  <properties>
    <quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
    <quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
    <quarkus.platform.version>2.8.3.Final</quarkus.platform.version>
  </properties>

Application A successfully passes its requests to the proxy server, while B wont. Both applications are very similiar when comparing their pom.xml files and application.properties files. I am struggling to point out relevant differences. I would like to at least get some pointers on where I could look to fix this problem.

Other things I have attempted in addition to passing -Dhttp.proxyHost and -Dhttp.proxyPort:

System info

Upvotes: 1

Views: 1280

Answers (1)

ewramner
ewramner

Reputation: 6233

Quarkus comes with two REST clients, the old classic version and the newer reactive one. The reactive client has proxy support; the classic does not advertise it. Try to switch to the reactive client.

(copied from comment)

Upvotes: 2

Related Questions