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.

flavian
  • 625
  • 1
  • 6
  • 9

1 Answers1

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>
Michael Hampton
  • 237,123
  • 42
  • 477
  • 940