Skip to content

Commit

Permalink
refactor: allow _dadi request
Browse files Browse the repository at this point in the history
  • Loading branch information
jimlambie committed Nov 9, 2018
1 parent fc47ef8 commit 3f5344f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions dadi/lib/auth/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ const config = require(path.join(__dirname, '/../../../config.js'))
const help = require(path.join(__dirname, '/../help'))

function mustAuthenticate (requestUrl) {
// Allow internal requests.
if (requestUrl.indexOf('/_dadi') === 0) {
return false
}

// All /api requests must be authenticated.
return requestUrl.indexOf('/api') === 0
}
Expand Down
5 changes: 4 additions & 1 deletion dadi/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,10 @@ Server.prototype.start = function (done) {
if (config.get('multiDomain.enabled')) {
let domain = req.headers.host.split(':')[0]

if (!domainManager.getDomain(domain)) {
if (
!config.get('dadiNetwork.enableConfigurationAPI') &&
!domainManager.getDomain(domain)
) {
return help.sendBackJSON(404, {
success: false,
message: `Domain not configured: ${domain}`
Expand Down

0 comments on commit 3f5344f

Please sign in to comment.