Skip to content

Commit

Permalink
Merge pull request #1378 from pelias/middleware_robots
Browse files Browse the repository at this point in the history
disallow robots from crawling the API
  • Loading branch information
orangejulius committed Nov 4, 2019
2 parents 4f8c9eb + 9dc7088 commit fc999ff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions app.js
Expand Up @@ -10,6 +10,7 @@ if( peliasConfig.api.accessLog ){

app.use( require('./middleware/headers') );
app.use( require('./middleware/cors') );
app.use( require('./middleware/robots') );
app.use( require('./middleware/options') );
app.use( require('./middleware/jsonp') );

Expand Down
9 changes: 9 additions & 0 deletions middleware/robots.js
@@ -0,0 +1,9 @@
// Prevent search engines from attempting to index the API
// https://developers.google.com/search/reference/robots_meta_tag#xrobotstag

function middleware(req, res, next) {
res.header('X-Robots-Tag', 'none');
next();
}

module.exports = middleware;

0 comments on commit fc999ff

Please sign in to comment.