Commit 51a08280 authored by Torstein Nicolaysen's avatar Torstein Nicolaysen
Browse files

DEICH-0000 fix robots.txt

parent bfaf1503
......@@ -22,6 +22,7 @@ const ssoCallbackRoute = require("./server/routes/sso-callback");
const logger = require("./logger")(__filename);
const dev = process.env.NODE_ENV !== "production";
const zone = process.env.ZONE || "production";
const app = next({ dev });
const handler = app.getRequestHandler();
const port = process.env.PORT || 3000;
......@@ -182,10 +183,10 @@ app
server.use("/robots.txt", (req, res) => {
res.type("text/plain");
if (dev) {
res.send("User-agent: *\nDisallow: /"); // Disallow everything
if (zone !== "prod") {
res.send("User-agent: *\nDisallow: /"); // Disallow everything (stops Google, Bing etc. from indexing our test environment)
} else {
res.send("User-agent: *\nDisallow:"); // Allow everything
res.send(`User-agent: *\nDisallow: `); // Allow everything
}
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment