Module: WEBrick::Config

Defined in:

Constant Summary collapse


Default SSL server configuration.

WEBrick can automatically create a self-signed certificate if :SSLCertName is set. For more information on the various SSL options see OpenSSL::SSL::SSLContext.


The server software name used in the Server: header.



Enable SSL for this server.  Defaults to false.

The SSL certificate for the server.


The SSL private key for the server certificate.



Array of certificates that will be sent to the client.


Array of certificates that will be added to the certificate chain


Path to a CA certificate file


Path to a directory containing CA certificates


OpenSSL::X509::Store used for certificate validation of the client


Callback invoked when DH parameters are required.

Sets whether the client is verified. This defaults to VERIFY_NONE which is typical for an HTTPS server.


Number of CA certificates to walk when verifying a certificate chain


Custom certificate verification callback


Maximum session lifetime


Various SSL options


Immediately start SSL upon connection? Defaults to true


SSL certificate name. Must be set to enable automatic certificate creation.


Comment used during automatic certificate creation.

  :ServerSoftware       => "#{svrsoft} OpenSSL/#{osslv}",
  :SSLEnable            => false,
  :SSLCertificate       => nil,
  :SSLPrivateKey        => nil,
  :SSLClientCA          => nil,
  :SSLExtraChainCert    => nil,
  :SSLCACertificateFile => nil,
  :SSLCACertificatePath => nil,
  :SSLCertificateStore  => nil,
  :SSLTmpDhCallback     => nil,
  :SSLVerifyClient      => ::OpenSSL::SSL::VERIFY_NONE,
  :SSLVerifyDepth       => nil,
  :SSLVerifyCallback    => nil,   # custom verification
  :SSLTimeout           => nil,
  :SSLOptions           => nil,
  :SSLStartImmediately  => true,
  # Must specify if you use auto generated certificate.
  :SSLCertName          => nil,
  :SSLCertComment       => "Generated by Ruby/OpenSSL"


General =

for GenericServer

  :ServerName     => Utils::getservername,
  :BindAddress    => nil,   # "" or "::" or nil
  :Port           => nil,   # users MUST specify this!!
  :MaxClients     => 100,   # maximum number of the concurrent connections
  :ServerType     => nil,   # default: WEBrick::SimpleServer
  :Logger         => nil,   # default:
  :ServerSoftware => "WEBrick/#{WEBrick::VERSION} " +
  :TempDir        => ENV['TMPDIR']||ENV['TMP']||ENV['TEMP']||'/tmp',
  :DoNotListen    => false,
  :StartCallback  => nil,
  :StopCallback   => nil,
  :AcceptCallback => nil,
  :DoNotReverseLookup => nil,
  :ShutdownSocketWithoutClose => false,

for HTTPServer, HTTPRequest, HTTPResponse …

  :Port           => 80,
  :RequestTimeout => 30,
  :HTTPVersion    =>"1.1"),
  :AccessLog      => nil,
  :MimeTypes      => HTTPUtils::DefaultMimeTypes,
  :DirectoryIndex => ["index.html","index.htm","index.cgi","index.rhtml"],
  :DocumentRoot   => nil,
  :DocumentRootOptions => { :FancyIndexing => true },
  :RequestCallback => nil,
  :ServerAlias    => nil,
  :InputBufferSize  => 65536, # input buffer size in reading request body
  :OutputBufferSize => 65536, # output buffer size in sending File or IO

  # for HTTPProxyServer
  :ProxyAuthProc  => nil,
  :ProxyContentHandler => nil,
  :ProxyVia       => true,
  :ProxyTimeout   => true,
  :ProxyURI       => nil,

  :CGIInterpreter => nil,
  :CGIPathEnv     => nil,

  # workaround: if Request-URIs contain 8bit chars,
  # they should be escaped before calling of URI::parse().
  :Escape8bitURI  => false
FileHandler =

Default configuration for WEBrick::HTTPServlet::FileHandler


Array of languages allowed for accept-language. There is no default


Allows preprocessing of directory requests. There is no default callback.


If true, show an index for directories. The default is true.


Allows preprocessing of file requests. There is no default callback.


Allows preprocessing of requests. There is no default callback.


Maps file suffixes to file handlers. DefaultFileHandler is used by default but any servlet can be used.


Do not show files matching this array of globs. .ht* and *~ are excluded by default.


Directory inside ~user to serve content from for /~user requests. Only works if mounted on /. Disabled by default.

  :NondisclosureName => [".ht*", "*~"],
  :FancyIndexing     => false,
  :HandlerTable      => {},
  :HandlerCallback   => nil,
  :DirectoryCallback => nil,
  :FileCallback      => nil,
  :UserDir           => nil,  # e.g. "public_html"
  :AcceptableLanguages => []  # ["en", "ja", ... ]
BasicAuth =

Default configuration for WEBrick::HTTPAuth::BasicAuth


Reload the user database provided by :UserDB automatically?

  :AutoReloadUserDB     => true,
DigestAuth =

Default configuration for WEBrick::HTTPAuth::DigestAuth.


MD5, MD5-sess (default), SHA1, SHA1-sess


An Array of URIs that define the protected space


‘auth’ for authentication, ‘auth-int’ for integrity protection or both


Should the server send opaque values to the client? This helps prevent replay attacks.


Should the server check the nonce count? This helps the server detect replay attacks.


Should the server send an AuthenticationInfo header?


Reload the user database provided by :UserDB automatically?


How long should we store used nonces? Default is 30 minutes.


How long is a nonce valid? Default is 1 minute


Hack which allows Internet Explorer to work.


Hack which allows Opera to work.

  :Algorithm            => 'MD5-sess', # or 'MD5'
  :Domain               => nil,        # an array includes domain names.
  :Qop                  => [ 'auth' ], # 'auth' or 'auth-int' or both.
  :UseOpaque            => true,
  :UseNextNonce         => false,
  :CheckNc              => false,
  :UseAuthenticationInfoHeader => true,
  :AutoReloadUserDB     => true,
  :NonceExpirePeriod    => 30*60,
  :NonceExpireDelta     => 60,
  :InternetExplorerHack => true,
  :OperaHack            => true,