diff --git a/mighttpd2.cabal b/mighttpd2.cabal
--- a/mighttpd2.cabal
+++ b/mighttpd2.cabal
@@ -1,5 +1,5 @@
 Name:                   mighttpd2
-Version:                3.0.3
+Version:                3.0.4
 Author:                 Kazu Yamamoto <kazu@iij.ad.jp>
 Maintainer:             Kazu Yamamoto <kazu@iij.ad.jp>
 License:                BSD3
@@ -54,9 +54,9 @@
                       , unix
                       , unix-time
                       , unordered-containers
-                      , wai >= 2.0
+                      , wai >= 2.1
                       , wai-app-file-cgi >= 1.0
-                      , warp >= 2.0
+                      , warp >= 2.1
 
 Executable mighty
   Default-Language:     Haskell2010
diff --git a/src/Server.hs b/src/Server.hs
--- a/src/Server.hs
+++ b/src/Server.hs
@@ -160,15 +160,14 @@
 #endif
   where
     debug = opt_debug_mode opt
-    setting = defaultSettings {
-        settingsPort        = opt_port opt
-      , settingsOnException = if debug then printStdout else warpHandler rpt
-      , settingsOnOpen      = increment stt
-      , settingsOnClose     = decrement stt
-      , settingsTimeout     = opt_connection_timeout opt
-      , settingsHost        = HostAny
-      , settingsFdCacheDuration     = opt_fd_cache_duration opt
-      }
+    setting = setPort        (opt_port opt)
+            $ setOnException (if debug then printStdout else warpHandler rpt)
+            $ setOnOpen      (\_ -> increment stt >> return True)
+            $ setOnClose     (\_ -> decrement stt)
+            $ setTimeout     (opt_connection_timeout opt)
+            $ setHost        HostAny
+            $ setFdCacheDuration (opt_fd_cache_duration opt)
+            defaultSettings
     serverName = BS.pack $ opt_server_name opt
     cspec = ClassicAppSpec {
         softwareName = serverName
