···63 corsOrigins := cctx.StringSlice("cors-allowed-origins")
64 staticCDNHost := cctx.String("static-cdn-host")
65 staticCDNHost = strings.TrimSuffix(staticCDNHost, "/")
66+ canonicalInstance := cctx.Bool("bsky-canonical-instance")
67+ robotsDisallowAll := cctx.Bool("robots-disallow-all")
6869 // Echo
70 e := echo.New()
···206 return http.FS(fsys)
207 }())
208209+ // enable some special endpoints for the "canonical" deployment (bsky.app). not having these enabled should *not* impact regular operation
210+ if canonicalInstance {
211+ e.GET("/ips-v4", echo.WrapHandler(staticHandler))
212+ e.GET("/ips-v6", echo.WrapHandler(staticHandler))
213+ e.GET("/security.txt", func(c echo.Context) error {
214+ return c.Redirect(http.StatusMovedPermanently, "/.well-known/security.txt")
215+ })
216+ e.GET("/.well-known/*", echo.WrapHandler(staticHandler))
217+ }
218+219+ // default to permissive, but Disallow all if flag set
220+ if robotsDisallowAll {
221+ e.File("/robots.txt", "static/robots-disallow-all.txt")
222+ } else {
223+ e.GET("/robots.txt", echo.WrapHandler(staticHandler))
224+ }
225+226 e.GET("/iframe/youtube.html", echo.WrapHandler(staticHandler))
227 e.GET("/static/*", echo.WrapHandler(http.StripPrefix("/static/", staticHandler)), func(next echo.HandlerFunc) echo.HandlerFunc {
228 return func(c echo.Context) error {
+3
bskyweb/static/robots-disallow-all.txt
···000
···1+# This is an development or self-hosted instance of the bsky web app, and crawling has been disallowed by the operator team.
2+User-Agent: *
3+Disallow: /