<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Server on genhttp-kt</title><link>https://genhttp-kt.genhttp.run/documentation/server/</link><description>Recent content in Server on genhttp-kt</description><generator>Hugo</generator><language>en-us</language><atom:link href="https://genhttp-kt.genhttp.run/documentation/server/index.xml" rel="self" type="application/rss+xml"/><item><title>Logging</title><link>https://genhttp-kt.genhttp.run/documentation/server/logging/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://genhttp-kt.genhttp.run/documentation/server/logging/</guid><description>&lt;p&gt;genhttp-kt logs through &lt;a href="https://www.slf4j.org/" rel="noopener"&gt;SLF4J&lt;/a&gt;, the logging facade of the JVM,&#10;and allows to create loggers via the &lt;code&gt;Server&lt;/code&gt; interface. If there is an SLF4J provider on the&#10;classpath (such as Logback, Log4j 2 or slf4j-simple), the server logs through it. Otherwise,&#10;the host falls back to a console logger of its own (and SLF4J warns once at startup that it&#10;found no provider).&lt;/p&gt;&#10;&lt;h2 id="logging-information"&gt;Logging Information&lt;a class="anchor" href="#logging-information" aria-label="Link to this section"&gt;&lt;svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"&gt;&lt;path d="M4 9h16M4 15h16M10 3 8 21M16 3l-2 18"/&gt;&lt;/svg&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;The following code shows to obtain a logger from the server instance in&#10;a custom &lt;code&gt;Handler&lt;/code&gt; implementation. It is recommended to create the logger&#10;once in the preparation phase and store the reference somewhere. You can use&#10;this pattern anywhere where you have access to &lt;code&gt;Server&lt;/code&gt; (e.g. via &lt;code&gt;request.server&lt;/code&gt;).&lt;/p&gt;</description></item><item><title>Endpoints and Ports</title><link>https://genhttp-kt.genhttp.run/documentation/server/endpoints/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://genhttp-kt.genhttp.run/documentation/server/endpoints/</guid><description>&lt;p&gt;By default, the server will listen on port 8080 for incoming IPv4 or IPv6 connections on&#10;any interface. To simply change the port the server will listen on, you can use&#10;the &lt;code&gt;port()&lt;/code&gt; directive of the host. Please note, that hosting a server on ports below 1024&#10;will require additional permissions on some operating systems.&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&#10; &lt;div class="code-bar"&gt;&#10; &lt;span class="code-lang"&gt;Kotlin&lt;/span&gt;&#10; &lt;button class="code-copy" type="button" data-copy aria-label="Copy the code" hidden&gt;&lt;svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"&gt;&lt;rect width="14" height="14" x="8" y="8" rx="2"/&gt;&lt;path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/&gt;&lt;/svg&gt;&lt;svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"&gt;&lt;path d="M20 6 9 17l-5-5"/&gt;&lt;/svg&gt;&lt;span&gt;Copy&lt;/span&gt;&lt;/button&gt;&#10; &lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-kotlin" data-lang="kotlin"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;val&lt;/span&gt; &lt;span class="py"&gt;app&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Layout&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;create&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;val&lt;/span&gt; &lt;span class="py"&gt;host&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Host&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;create&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;To configure the server to listen on specific interfaces only, you can &lt;code&gt;bind()&lt;/code&gt; those&#10;endpoints explicitly. As soon as an endpoint is bound, the port set via &lt;code&gt;port()&lt;/code&gt; is ignored.&lt;/p&gt;</description></item><item><title>Security</title><link>https://genhttp-kt.genhttp.run/documentation/server/security/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://genhttp-kt.genhttp.run/documentation/server/security/</guid><description>&lt;p&gt;This page summarizes security considerations and configuration options&#10;when running genhttp-kt applications.&lt;/p&gt;&#10;&lt;h2 id="general-considerations"&gt;General Considerations&lt;a class="anchor" href="#general-considerations" aria-label="Link to this section"&gt;&lt;svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"&gt;&lt;path d="M4 9h16M4 15h16M10 3 8 21M16 3l-2 18"/&gt;&lt;/svg&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;genhttp-kt is designed to be used as an application server behind a reverse proxy, and therefore does not provide built-in DoS protection (such as IP connection limits or Slowloris prevention).&#10;However, its engines are hardened against typical attack vectors such as request smuggling, header injection, or malformed chunk attacks:&#10;both parse requests with a port of &lt;a href="https://github.com/dotnet-web-stack/Glyph11" rel="noopener"&gt;Glyph11&lt;/a&gt;, the hardened parser of GenHTTP, and passes&#10;the ported acceptance tests of GenHTTP, which is &lt;a href="https://www.http-probe.com/servers/genhttp.html" rel="noopener"&gt;explicitly tested&lt;/a&gt; for these attacks.&lt;/p&gt;</description></item></channel></rss>