diff --git a/Network/Wai/Application/Classic/Path.hs b/Network/Wai/Application/Classic/Path.hs
--- a/Network/Wai/Application/Classic/Path.hs
+++ b/Network/Wai/Application/Classic/Path.hs
@@ -4,13 +4,13 @@
     Path(..)
   , fromString, fromByteString
   , (+++), (</>), (<\>), (<.>)
-  , breakAtSeparator, hasTrailingPathSeparator
+  , breakAtSeparator, hasLeadingPathSeparator, hasTrailingPathSeparator
   , isSuffixOf
   ) where
 
 import qualified Blaze.ByteString.Builder as BB
 import Data.ByteString (ByteString)
-import qualified Data.ByteString as BS (null, last, append, drop, length, breakByte, isSuffixOf)
+import qualified Data.ByteString as BS (null, head, tail, last, append, drop, length, breakByte, isSuffixOf)
 import qualified Data.ByteString.Char8 as BS (pack, unpack)
 import Data.Monoid
 import Data.String
@@ -54,9 +54,25 @@
 {-|
   Checking if the path ends with the path separator.
 
+>>> hasLeadingPathSeparator "/foo/bar"
+True
+>>> hasLeadingPathSeparator "foo/bar"
+False
+-}
+hasLeadingPathSeparator :: Path -> Bool
+hasLeadingPathSeparator path
+  | BS.null bs            = False
+  | BS.head bs == pathSep = True
+  | otherwise             = False
+  where
+    bs = pathByteString path
+
+{-|
+  Checking if the path ends with the path separator.
+
 >>> hasTrailingPathSeparator "/foo/bar/"
 True
->>>  hasTrailingPathSeparator "/foo/bar"
+>>> hasTrailingPathSeparator "/foo/bar"
 False
 -}
 hasTrailingPathSeparator :: Path -> Bool
@@ -88,21 +104,31 @@
 "/foo/bar"
 >>> "/foo/" </> "bar"
 "/foo/bar"
+>>> "/foo" </> "/bar"
+"/foo/bar"
+>>> "/foo/" </> "/bar"
+"/foo/bar"
 -}
 
 (</>) :: Path -> Path -> Path
 p1 </> p2
-  | hasTrailingPathSeparator p1 = p1 +++ p2
-  | otherwise                   = Path {
-      pathString = BS.unpack p
-    , pathByteString = p
-    }
+  | has1 && not has2 || not has1 && has2 = p1 +++ p2
+  | has1      = toPath pp1
+  | otherwise = toPath pp2
   where
+    has1 = hasTrailingPathSeparator p1
+    has2 = hasLeadingPathSeparator p2
     p1' = pathByteString p1
     p2' = pathByteString p2
-    p = BB.toByteString (BB.fromByteString p1'
-                       `mappend` BB.fromWord8 pathSep
-                       `mappend` BB.fromByteString p2')
+    toPath p = Path {
+        pathString = BS.unpack p
+      , pathByteString = p
+      }
+    pp1 = BB.toByteString (BB.fromByteString p1'
+                           `mappend` BB.fromByteString (BS.tail p2'))
+    pp2 = BB.toByteString (BB.fromByteString p1'
+                           `mappend` BB.fromWord8 pathSep
+                           `mappend` BB.fromByteString p2')
 
 {-|
   Removing prefix. The prefix of the second argument is removed
diff --git a/Network/Wai/Application/Classic/RevProxy.hs b/Network/Wai/Application/Classic/RevProxy.hs
--- a/Network/Wai/Application/Classic/RevProxy.hs
+++ b/Network/Wai/Application/Classic/RevProxy.hs
@@ -4,10 +4,11 @@
 
 import Control.Applicative
 import Control.Exception (SomeException)
-import Control.Exception.Lifted (catch)
+import Control.Exception.Lifted (catch, throwIO)
 import Control.Monad.IO.Class (liftIO)
 import qualified Data.ByteString.Char8 as BS
 import Data.Conduit
+import Data.Conduit.List (sourceNull)
 import Data.Int
 import Data.Maybe
 import qualified Network.HTTP.Conduit as H
@@ -65,7 +66,7 @@
     let mlen = getLen req
         len = fromMaybe 0 mlen
         httpReq = toHTTPRequest req route len
-    H.Response status hdr downbody <- H.http httpReq mgr
+    H.Response status hdr downbody <- http httpReq mgr
     let hdr' = fixHeader hdr
     liftIO $ logger cspec req status (fromIntegral <$> mlen)
     return $ ResponseSource status hdr' (Chunk . byteStringToBuilder <$> downbody)
@@ -73,7 +74,17 @@
     mgr = revProxyManager spec
     fixHeader = addVia cspec req . filter p
     p ("Content-Encoding", _) = False
+    p ("Content-Length", _)   = False
     p _ = True
+
+type Resp = ResourceT IO (H.Response (Source IO BS.ByteString))
+
+http :: H.Request IO -> H.Manager -> Resp
+http req mgr = H.http req mgr `catch` notSuccess
+
+notSuccess :: H.HttpException -> Resp
+notSuccess (H.StatusCodeException st hdr) = return $ H.Response st hdr sourceNull
+notSuccess e                              = throwIO e
 
 badGateway :: ClassicAppSpec -> Request-> SomeException -> ResourceT IO Response
 badGateway cspec req _ = do
diff --git a/wai-app-file-cgi.cabal b/wai-app-file-cgi.cabal
--- a/wai-app-file-cgi.cabal
+++ b/wai-app-file-cgi.cabal
@@ -1,5 +1,5 @@
 Name:                   wai-app-file-cgi
-Version:                0.5.2
+Version:                0.5.3
 Author:                 Kazu Yamamoto <kazu@iij.ad.jp>
 Maintainer:             Kazu Yamamoto <kazu@iij.ad.jp>
 License:                BSD3
@@ -59,9 +59,31 @@
   Type:                 exitcode-stdio-1.0
   Build-Depends:        base >= 4 && < 5
                       , HUnit
+                      , alternative-io
+                      , attoparsec >= 0.10.0.0
+                      , attoparsec-conduit
+                      , blaze-builder
+                      , bytestring
+                      , case-insensitive
+                      , conduit >= 0.2
+                      , containers
+                      , directory
+                      , filepath
+                      , http-conduit
+                      , http-date
+                      , http-types
+                      , lifted-base
+                      , network
+                      , process
+                      , static-hash
                       , test-framework-doctest
                       , test-framework-hunit
                       , test-framework-th-prime
+                      , transformers
+                      , unix
+                      , wai >= 1.1
+                      , wai-app-static >= 0.3
+                      , wai-logger
 
 Source-Repository head
   Type:                 git
