How to Set Advanced Payara Server HTTP Listener Options

Uncategorized

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.

httplisteneerconfig-1

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 configs.config.server-config.network-config.protocols.protocol.http-listener-1.http.max-response-headers=1000

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.

 

 

 

Comments (8)

Post a comment

Your email address will not be published. Required fields are marked *

Payara needs the contact information you provide to us to contact you about our products and services. You may unsubscribe from these communications at any time. For information on how to unsubscribe, as well as our privacy practices and commitment to protecting your privacy, please review our Legal & Privacy Policy.

  1. Ciment Maltu

    Hello Ondrej,

    It is possible to enable or disable Http2 support for http-listeners via asadmin command? I am not able to find out the right property name.

    Thanks

    1. Ondro Mihalyi

      Hi,

      Asadmin command to disable HTTP/2 on a listener:

      set configs.config.server-config.network-config.protocols.protocol.http-listener-2.http.http2-enabled=false

      Asadmin command to disable only HTTP/2 server push (which causes issues with some web frameworks):

      set configs.config.server-config.network-config.protocols.protocol.http-listener-1.http.http2-push-enabled=false

      Full documentation:

      https://docs.payara.fish/documentation/payara-server/server-configuration/http/protocols.html#configuration-http-http2

  2. MARISELVAM PALANISELVAM

    Hi,

    Is there a chance Payara 5 might loss session on old servlet app.

    1. Ondrej Mihalyi

      Hi Mariselvam,

      Payara Server 5 is backward-compatible with the older Servlet specification and with Payara Server 4. The only big difference is that it uses HTTP/2 by default, which may cause some issues with older applications. If you have issues, the first thing to try is disabling HTTP/2 as I described in the previous comment in reply to Ciment.

      You can also review our migration guides from Payara Server 4 and also from other application servers: https://www.payara.fish/documentation/migration-guide/. You may find something useful there.

  3. Sayanora V

    What is the “backend” command to make admin console(port 4848?) listen on localhost, instead of all IPs?

    1. Ondro Mihalyi

      Hi Sayonara,

      To make the Admin Console listen only on localhost and not all IPs, you need to set the address property of the Admin Network listener from 0.0.0.0 to localhost. You can do this in the Admin Console, in server-config -> Network Config -> Network Listeners -> admin-listener, or using the following asadmin command: “set configs.config.server-config.network-config.network-listeners.network-listener.admin-listener.address=localhost”

  4. Martin Kovac

    We are using Payara 5.2020.7 with JDK8 zulu-8.jdk, but setting max-response-header for http2 listener ssl enabled listener is always ignored. (It works for http listener).
    Any ideas please ?

    1. Ondro Mihalyi

      Hi Martin,

      Please, describe your problem in Payara forum with more details (https://payara.org/forum), it’s a better place to raise questions about technical setup or issues. It’s also possible that this is an unexpected behavior. In that case, feel free to raise an issue on github with a description how to reproduce the unexpected behavior: https://github.com/payara/Payara/issues

Related Posts

4 minutes
Uncategorized

Leading the Way: Payara Platform Community 7 Beta Now Fully Jakarta EE 11 Certified

We’re excited to announce that Payara Platform Community 7 Beta application server is now fully certified as Jakarta EE 11 […]

What Is a Java Application Server? A Short Guide 6 minutes
Jakarta EE

What Is a Java Application Server? A Short Guide

Enterprise Java applications power global commerce, healthcare, government and countless other industries. These systems must be scalable, secure and […]

10 minutes
Uncategorized

Java’s 30th Anniversary: A Celebration of Legacy, Evolution and Community

May 2025 marks a monumental milestone in software development: Java turns 30. The impact of this language on the […]