Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Quarkus to listen on all network interfaces instead of localhost?

Tags:

quarkus

When I run my Quarkus application it listens/binds to localhost only by default.

How can I alter this behavior?

like image 959
geoand Avatar asked Mar 07 '19 12:03

geoand


1 Answers

UPDATE

With the inclusion of this PR in Quarkus, starting with version 0.12.0 the configuration explained in the following section will no longer be needed since Quarkus will use 0.0.0.0 as the default host.


By default Quarkus only listens on localhost (127.0.0.1). To make Quarkus listen on all network interfaces (something that is very handy for example when running inside a Docker container or Kubernetes Pod), the quarkus.http.host property needs to be set.

If you always want your Quarkus application to listen on all interfaces you can set quarkus.http.host=0.0.0.0 in your application.properties (under src/main/resources).

If you would rather keep the default setting and only override at runtime, you can do that as follows:

When running a Quarkus application in JVM mode you can set the port using the quarkus.http.host System property to 0.0.0.0. For example:

java -Dquarkus.http.host=0.0.0.0 -jar example-runner.java

The same property applies to GraalVM Native Mode images. For example:

./example-runner -Dquarkus.http.host=0.0.0.0
like image 72
geoand Avatar answered Oct 15 '22 03:10

geoand