/**
 * Created by Omnius on 18/07/2016.
 */
'use strict';

const Boom = require('boom');

module.exports = (route, options) => {

    options.type = options.type || 'notfound';

    return (request, reply) => {

        if (options.type === 'index') {
            return reply.redirect('/login')
                .header('X-Permitted-Cross-Domain-Policies', 'master-only');
        }
        if (options.type === 'notfound') {
            return reply(Boom.notFound('Page Not Found'));
        }
    };
};

/**
 * Created by Omnius on 18/07/2016.
 */
'use strict';

module.exports = (route, options) => {

    options.type = options.type || 'notfound';

    return (request, reply) => {

        if (options.type === 'index') {
            return reply.redirect('/login');
        }
        if (options.type === 'notfound') {
            return reply.view('error', {
                title: '404 - Page Not Found',
                h1: '404 - Page Not Found',
                message: 'The resource you are looking for does not exist.'
            }).code(404);
        }

        return reply.continue();
    };
};

Remove x-permitted-cross-domain-policies on redirect and apply error page when resource is not found
Remove x-permitted-cross-domain-policies on redirect and apply error page when resource is not found
