我尝试重定向到index.html页面,路径为“/ hello”>> = redirect“index.html”,它一直给出错误没有收到数据ERR_EMPTY_RESPONSE。
I don't think there is anything wrong with redirection in Suave. The following works fine for me:
#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
As Fyodor mentioned in the comments, I'd check if your handler for index.html
is working correctly. You can also check the returned redirect header in Fiddler or in Chrome dev tools.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.