5

How do you disable keep-alive in Jetty 9?

Running under 64 bit CentOS if it makes a difference.

An XML config solution is preferred.

1 Answer 1

8

You really don't want to disable keep-alive. Your server performance will suffer, for starters. Your clients will experience slower loading times. In rare cases, you may even get fired.

Don't even THINK about doing this on a production web site.

If you're just testing, you can set the HTTP header Connection: Close.

<Configure id="Server" class="org.eclipse.jetty.server.Server">
  <New id="Rewrite" class="org.eclipse.jetty.rewrite.handler.RewriteHandler">

    <Call name="addRule">
      <Arg>
        <New class="org.eclipse.jetty.rewrite.handler.HeaderPatternRule">
          <Set name="name">Connection</Set>
          <Set name="value">close</Set>
        </New>
      </Arg>
    </Call>

  <Set name="handler"><Ref id="Rewrite" /></Set>
</Configure>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .