diff --git a/src/Network/WebSockets/Handshake/Http.hs b/src/Network/WebSockets/Handshake/Http.hs
--- a/src/Network/WebSockets/Handshake/Http.hs
+++ b/src/Network/WebSockets/Handshake/Http.hs
@@ -15,7 +15,7 @@
 
 import Data.Dynamic (Typeable)
 import Data.Monoid (mappend, mconcat)
-import Control.Applicative ((<$>), (<*>), (*>), (<*))
+import Control.Applicative (pure, (<$>), (<*>), (*>), (<*))
 import Control.Exception (Exception)
 import Control.Monad.Error (Error (..))
 
@@ -34,6 +34,7 @@
 data RequestHttpPart = RequestHttpPart
     { requestHttpPath    :: !B.ByteString
     , requestHttpHeaders :: Headers
+    , requestHttpSecure  :: Bool
     } deriving (Eq, Show)
 
 -- | Full request type
@@ -82,10 +83,11 @@
 getSecWebSocketVersion p = lookup "Sec-WebSocket-Version" (requestHttpHeaders p)
 
 -- | Parse an initial request
-decodeRequest :: A.Parser RequestHttpPart
-decodeRequest = RequestHttpPart
+decodeRequest :: Bool -> A.Parser RequestHttpPart
+decodeRequest isSecure = RequestHttpPart
     <$> requestLine
     <*> A.manyTill header newline
+    <*> pure isSecure
   where
     space   = A.word8 (c2w ' ')
     newline = A.string "\r\n"
diff --git a/src/Network/WebSockets/Monad.hs b/src/Network/WebSockets/Monad.hs
--- a/src/Network/WebSockets/Monad.hs
+++ b/src/Network/WebSockets/Monad.hs
@@ -80,7 +80,8 @@
 
 -- | Receives the initial client handshake, then behaves like 'runWebSockets'.
 runWebSocketsHandshake :: Protocol p
-                       => (Request -> WebSockets p a)
+                       => Bool
+                       -> (Request -> WebSockets p a)
                        -> Iteratee ByteString IO ()
                        -> Iteratee ByteString IO a
 runWebSocketsHandshake = runWebSocketsWithHandshake defaultWebSocketsOptions
@@ -89,11 +90,12 @@
 -- 'runWebSocketsWith'.
 runWebSocketsWithHandshake :: Protocol p
                            => WebSocketsOptions
+                           -> Bool
                            -> (Request -> WebSockets p a)
                            -> Iteratee ByteString IO ()
                            -> Iteratee ByteString IO a
-runWebSocketsWithHandshake opts goWs outIter = do
-    httpReq <- receiveIteratee decodeRequest
+runWebSocketsWithHandshake opts isSecure goWs outIter = do
+    httpReq <- receiveIteratee $ decodeRequest isSecure
     runWebSocketsWith opts httpReq goWs outIter
 
 -- | Run a 'WebSockets' application on an 'Enumerator'/'Iteratee' pair, given
diff --git a/src/Network/WebSockets/Protocol/Hybi00/Internal.hs b/src/Network/WebSockets/Protocol/Hybi00/Internal.hs
--- a/src/Network/WebSockets/Protocol/Hybi00/Internal.hs
+++ b/src/Network/WebSockets/Protocol/Hybi00/Internal.hs
@@ -70,7 +70,7 @@
 handshakeHybi00 :: Monad m
                 => RequestHttpPart
                 -> E.Iteratee B.ByteString m Request
-handshakeHybi00 reqHttp@(RequestHttpPart path h) = do
+handshakeHybi00 reqHttp@(RequestHttpPart path h isSecure) = do
     keyPart3 <- A.iterParser $ A.take 8
     keyPart1 <- numberFromToken =<< getHeader "Sec-WebSocket-Key1"
     keyPart2 <- numberFromToken =<< getHeader "Sec-WebSocket-Key2"
@@ -81,8 +81,9 @@
     host <- getHeader "Host"
     -- todo: origin right? (also applies to hybi10)
     origin <- getHeader "Origin"
+    let schema = if isSecure then "wss://" else "ws://"
     let response = response101
-            [ ("Sec-WebSocket-Location", B.concat ["ws://", host, path])
+            [ ("Sec-WebSocket-Location", B.concat [schema, host, path])
             , ("Sec-WebSocket-Origin", origin)
             ]
             key
diff --git a/src/Network/WebSockets/Protocol/Hybi10/Internal.hs b/src/Network/WebSockets/Protocol/Hybi10/Internal.hs
--- a/src/Network/WebSockets/Protocol/Hybi10/Internal.hs
+++ b/src/Network/WebSockets/Protocol/Hybi10/Internal.hs
@@ -140,7 +140,7 @@
 handshakeHybi10 :: Monad m
                 => RequestHttpPart
                 -> E.Iteratee ByteString m Request
-handshakeHybi10 reqHttp@(RequestHttpPart path h) = do
+handshakeHybi10 reqHttp@(RequestHttpPart path h _) = do
     key <- getHeader "Sec-WebSocket-Key"
     let hash = unlazy $ bytestringDigest $ sha1 $ lazy $ key `mappend` guid
     let encoded = B64.encode hash
diff --git a/src/Network/WebSockets/Socket.hs b/src/Network/WebSockets/Socket.hs
--- a/src/Network/WebSockets/Socket.hs
+++ b/src/Network/WebSockets/Socket.hs
@@ -59,8 +59,8 @@
 runWithSocket :: Protocol p
               => Socket -> (Request -> WebSockets p a) -> IO a
 runWithSocket s ws = do
-    r <- E.run $ SE.enumSocket 4096 s $$
-        runWebSocketsWithHandshake defaultWebSocketsOptions ws (iterSocket s)
+    r <- E.run $ SE.enumSocket 4096 s $$ runWebSocketsWithHandshake
+        defaultWebSocketsOptions False ws (iterSocket s)
     S.sClose s
     either (error . show) return r
 
diff --git a/websockets.cabal b/websockets.cabal
--- a/websockets.cabal
+++ b/websockets.cabal
@@ -1,5 +1,5 @@
 Name:    websockets
-Version: 0.5.2.1
+Version: 0.6.0.0
 
 Synopsis:
   A sensible and clean way to write WebSocket-capable servers in Haskell.
