Use status 301 and 308

This commit is contained in:
Unknown 2018-10-30 10:16:30 +09:00
parent 875934360e
commit 820e13cffb

View file

@ -123,9 +123,10 @@
[{:keys [method] :or {method :both}}] [{:keys [method] :or {method :both}}]
(let [redirect-handler (fn redirect-handler [request] (let [redirect-handler (fn redirect-handler [request]
(let [uri (:uri request) (let [uri (:uri request)
status (if (= (:method request) :get) 301 308)
maybe-redirect (fn maybe-redirect [path] maybe-redirect (fn maybe-redirect [path]
(if (r/match-by-path (::r/router request) path) (if (r/match-by-path (::r/router request) path)
{:status 308 ; permanent redirect {:status status
:headers {"Location" path} :headers {"Location" path}
:body ""}))] :body ""}))]
(if (str/ends-with? uri "/") (if (str/ends-with? uri "/")