How to change Quarkus default HTTP Port?

Quarkus includes the “undertow” extension which is triggered when you include a JAXRS dependency in your project. We will see in this tutorial which are the most common settings you can apply to a Quarkus application to configure the embedded Undertow server.

First of all let’s specify how you can set configuration parameters on Quarkus. You have two main options:

  • Pass parameters on the Command Line using -D
  • Include parameters in the the file

Configuring HTTP Port

The most basic setting is the default HTTP Port, which can be overridden as follows in the file:


Configuring Host name

Next, here is how you can configure in the file the Host where the application will be bound (“Default is”):

Configuring HTTPS Port

In order to configure the secure port used for https connections, you can use this setting:


Configuring HTTP Test Port

Quarkus tests by default run on port 8081 to avoid conflict with the HTT Port. You can can configure the port used by tests by setting quarkus.http.test-port as follows:


Configuring the Context Path

Finally, another common setting is the Context Path, which defaults to the Root Context (“/”). Here is how to set it to a custom value:


Configuring CORS

Cross-origin resource sharing is a mechanism that allows some restricted resources on a web page to be requested from another domain outside the domain from which the first resource was served. In order to enable Cross-origin resource sharing you need to set the quarkus.http.cors property to true, which enables it through a Servlet Filter. Then, you can fine tune the CORS policy to allow specific headers or HTTP methods to be allowed.

Here is a fully configured which allows all HTTP methods from the site


Configuring IO Threads

The number if IO threads used to perform IO in Quarkus will be automatically set to a reasonable value based on the number of CPU cores. You can configure it using the following property:

Configuring HTTPS with Quarkus

You can configure secure connections for Web applications either with a PEM certificate or using a Keystore. Let’s see how to configure a keystore. First generate a self-signed keystore:

keytool -genkey -keyalg RSA -alias demo -keystore keystore.jks -storepass mypassword -validity 365 -keysize 2048

Then, provide in your configuration file a reference to the keystore and its password:

quarkus.http.ssl.certificate.key-store-file=/path/to/keystore.jks quarkus.http.ssl.certificate.key-store-password=mypassword


In order to configure the secure port used for https connections, you can use this setting: