Path: blob/master/src/packages/hub/servers/robots.ts
1503 views
import { get_server_settings } from "@cocalc/database/postgres/server-settings";12export default function getHandler() {3return async (_req, res) => {4const settings = await get_server_settings(); // don't worry -- this is cached.5res.header("Content-Type", "text/plain");6res.header("Cache-Control", "public, max-age=3600, must-revalidate");7if (!settings.landing_pages) {8// Default: -- disable everything except /share.9res.write(`User-agent: *10Allow: /share11Disallow: /12`);13} else {14// If landing pages are enabled, which should only be cocalc.com (and maybe some test sites temporarily),15// then we only disallow some obvious bad routes. This allows the share server, landing pages, etc.16// If we need to switch to a whitelist, see app/next.ts for what to allow...17res.write(`User-agent: *18Disallow: /static/19Disallow: /projects/20Disallow: /*/raw/21Disallow: /*/port/22Disallow: /*/server/23Disallow: /haproxy24`);25}26res.end();27};28}293031