-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds robots.txt file to discourage crawling
- Loading branch information
1 parent
f830bde
commit 710725f
Showing
6 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
User-agent: * | ||
Disallow: / | ||
Allow: /$ | ||
Allow: /signup$ | ||
Allow: /assets/ | ||
Allow: /storage/*/public/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* eslint-env mocha */ | ||
|
||
const chai = require('chai'); | ||
const expect = chai.expect; | ||
chai.use(require('chai-http')); | ||
const { mockAccountFactory } = require('../util/mockAccount'); | ||
const appFactory = require('../../lib/appFactory'); | ||
const { configureLogger } = require('../../lib/logger'); | ||
|
||
describe('robots.txt', function () { | ||
before(async function () { | ||
configureLogger({ log_dir: './test-log', stdout: [], log_files: ['error'] }); | ||
|
||
const app = await appFactory({ | ||
hostIdentity: 'autotest.ch', | ||
jwtSecret: 'swordfish', | ||
accountMgr: mockAccountFactory('autotest.ch'), | ||
storeRouter: (_req, _res, next) => next() | ||
}); | ||
app.locals.title = 'Test Armadietto'; | ||
app.locals.host = 'localhost:xxxx'; | ||
app.locals.signup = false; | ||
this.app = app; | ||
}); | ||
|
||
it('should serve robots.txt at expected location', async function () { | ||
const res = await chai.request(this.app).get('/robots.txt'); | ||
expect(res).to.have.status(200); | ||
expect(res).to.have.header('Content-Type', /^text\/plain/); | ||
expect(parseInt(res.get('Content-Length'))).to.be.greaterThan(0); | ||
|
||
expect(res.text).to.match(/^User-agent: \*$/m); | ||
expect(res.text).to.match(/^Disallow: \/$/m); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters