How to Set Advanced Payara Server HTTP Listener Options

Photo of Ondro Mihályi by Ondro Mihályi

In order to fine tune a HTTP listener, the Payara Server administration console provides the means to configure a wide range of options. Besides the basic configuration available for a HTTP listener in the HTTP service section, it is also possible to set low-level configuration details in the HTTP tab of the same network listener in the Network-Config section.





However, I was recently solving a problem with Payara Server, where none of the available options were helpful. Payara Server was dropping responses while debugging an application with a REST endpoint, just because the number of headers was higher than allowed by the default configuration. The reason was that with Jersey request tracing turned on, Jersey (the JAX-RS API's implementation included with Payara Server) added an extra HTTP header to the response for every trace record, which was often over the threshold. Fortunately, there are more configuration options available under the hood, which are not exposed in the GUI admin console, nor by any higher level asadmin command.


If you come to a rare situation where no exposed configuration option helps and you tweak a HTTP listener to meet your needs, it might be useful to know how to configure additional options of the underlying Grizzly component. The networking subsystem of Payara Server is based on Grizzly, which is a non-blocking server framework to build robust, high-performant and scalable servers. Payara Server conveniently exposes all server configuration properties of the Grizzly component that are listed on the Grizzly documentation page. All the properties can be set in the configuration of a Payara Server network protocol using asadmin set command. It is only necessary to covert a property name in camel case into a dash-separated name.


For example, if your configuration is named server-config and the network listener is http-listener-1, then execute the following asadmin command to set a value of maxResponseHeaders Grizzly property to 1000:

asadmin> set

The above command increases the threshold for the number of headers in HTTP responses. This, in turn, solved my problem with the high amount of trace headers added by Jersey and responses being dropped.


You can use a similar command to set any Grizzly network listener properties. Just replace max-response-headers with the name of the option you want to set, using the dash character as a word separator instead of using the camel case notation.



Payara Server Admin & Maintenance  Advanced Guide