2015-11-07 65 views
3

我試着重定向到一個index.html頁面,路徑爲「/ hello」>> = redirect「index.html」,並且它一直給出錯誤沒有收到數據ERR_EMPTY_RESPONSE。重定向似乎不工作在Suave

+0

你還有一個爲「index.cshtml」定義的處理程序嗎? –

回答

2

我不認爲在Suave中重定向有什麼問題。對我很好了以下工作:

#r @"packages/Suave/lib/net40/Suave.dll" 
open Suave 
open Suave.Web 
open Suave.Http 
open Suave.Http.Applicatives 

choose 
    [ path "/index.html" >>= Successful.OK "Hello" 
    path "/redir" >>= Redirection.redirect "/index.html" ] 
|> startWebServer defaultConfig 

正如陀在評論中提到的,我會檢查你的index.html處理程序是否正常工作。您也可以在Fiddler或Chrome開發工具中檢查返回的重定向標頭。