<commit_before>const express = require('express');
const handlebars  = require('express-handlebars');
const app = express();

app.set('port', (process.env.PORT || 5000));

app.use(express.static(__dirname));

app.engine('.hbs', handlebars({
    defaultLayout : 'main',
    extname : '.hbs',
    layoutsDir : 'views/layouts/',
    partialsDir : 'views/partials/',
}));
app.set('view engine', '.hbs');

// HTTPS Enforcement Redirect
app.get('*',function(req, res, next){

    const exceptions = req.hostname === 'localhost' ||
                       req.hostname.match(/\.local$/);

    if (!req.secure && !exceptions) {
        console.log(`Insecure: ${req.hostname}`);
        console.log(`Insecure: ${req.protocol}`);

        req.headers.forEach(function (el) {
            console.log(`Header: ${el}`);
        })

        res.redirect(301, `https://derek.business${req.originalUrl}`);
    } else {
        next();
    }

});

// Canonical Hostname Enforcement Redirect
app.get('*',function(req, res, next){

    const exceptions = req.hostname === 'localhost' ||
                       req.hostname.match(/\.local$/) ||
                       req.hostname.match(/\.herokuapp.com$/) ||
                       req.hostname.match(/^derek\.business$/);
<commit_msg>But really headers<commit_after>const express = require('express');
const handlebars  = require('express-handlebars');
const app = express();

app.set('port', (process.env.PORT || 5000));

app.use(express.static(__dirname));

app.engine('.hbs', handlebars({
    defaultLayout : 'main',
    extname : '.hbs',
    layoutsDir : 'views/layouts/',
    partialsDir : 'views/partials/',
}));
app.set('view engine', '.hbs');

// HTTPS Enforcement Redirect
app.get('*',function(req, res, next){

    const exceptions = req.hostname === 'localhost' ||
                       req.hostname.match(/\.local$/);



                       Object.keys(req.headers).forEach(function(key) {
                           console.log(`Header: ${req.headers[key]}`);
                       });

    if (!req.secure && !exceptions) {
        console.log(`Insecure: ${req.hostname}`);
        console.log(`Insecure: ${req.protocol}`);

        Object.keys(req.headers).forEach(function(key) {
            console.log(`Header: ${req.headers[key]}`);
        });

        res.redirect(301, `https://derek.business${req.originalUrl}`);
    } else {
        next();
    }

});

// Canonical Hostname Enforcement Redirect
app.get('*',function(req, res, next){

    const exceptions = req.hostname === 'localhost' ||
                       req.hostname.match(/\.local$/) ||
                       req.hostname.match(/\.herokuapp.com$/) ||
                       req.hostname.match(/^derek\.business$/);

{'fraction_non_alphanumeric': 0.18932748538011696, 'fraction_numerical': 0.005116959064327485, 'mean_word_length': 2.4298245614035086, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1711352', 'n_tokens_mistral': 849, 'n_tokens_neox': 822, 'n_words': 136}