Skip to content

Commit be3b05d

Browse files
author
Bastien Guerry
committed
src/subscribe-dsfr.clj: Serve robots.txt to prevent crawling
1 parent ddd2c6e commit be3b05d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/subscribe-dsfr.clj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,11 @@
10221022
:headers {"Content-Type" "application/json; charset=UTF-8"}
10231023
:body (json/generate-string debug-info {:pretty true})}))
10241024

1025+
(defn handle-robots-txt []
1026+
{:status 200
1027+
:headers {"Content-Type" "text/plain; charset=UTF-8"}
1028+
:body "User-agent: *\nDisallow: /"})
1029+
10251030
;; Main app with routes
10261031
(defn app [req]
10271032
(let [uri (:uri req)
@@ -1035,6 +1040,7 @@
10351040
[:get "/"] (handle-index req-with-params)
10361041
[:post "/subscribe"] (handle-subscribe req-with-params)
10371042
[:get "/debug"] (handle-debug req-with-params)
1043+
[:get "/robots.txt"] (handle-robots-txt)
10381044
(do
10391045
(log/info "Not found:" (:request-method req) uri)
10401046
{:status 404

0 commit comments

Comments
 (0)