Skip to content

Instantly share code, notes, and snippets.

@stephencweiss
Created November 28, 2018 23:46
Show Gist options
  • Save stephencweiss/71fc020432193047ee0f6183d2b77489 to your computer and use it in GitHub Desktop.
Save stephencweiss/71fc020432193047ee0f6183d2b77489 to your computer and use it in GitHub Desktop.
proxy config
'use strict'
/**
* New Relic agent configuration.
*
* See lib/config/default.js in the agent distribution for a more complete
* description of configuration variables and their potential values.
*/
exports.config = {
/**
* Array of application names.
*/
app_name: ['Trailblazer - SDC'],
/**
* Your New Relic license key.
*/
license_key: 'c**************************************3',
logging: {
/**
* Level at which to log. 'trace' is most useful to New Relic when diagnosing
* issues with the agent, 'info' and higher will impose the least overhead on
* production applications.
*/
level: 'info'
},
/**
* When true, all request headers except for those listed in attributes.exclude
* will be captured for all traces, unless otherwise specified in a destination's
* attributes include/exclude lists.
*/
allow_all_headers: true,
attributes: {
/**
* Prefix of attributes to exclude from all destinations. Allows * as wildcard
* at end.
*
* NOTE: If excluding headers, they must be in camelCase form to be filtered.
*
* @env NEW_RELIC_ATTRIBUTES_EXCLUDE
*/
exclude: [
'request.headers.cookie',
'request.headers.authorization',
'request.headers.proxyAuthorization',
'request.headers.setCookie*',
'request.headers.x*',
'response.headers.cookie',
'response.headers.authorization',
'response.headers.proxyAuthorization',
'response.headers.setCookie*',
'response.headers.x*'
]
}
}
const nr = require('newrelic');
const express = require('express');
const morgan = require('morgan');
const path = require('path');
const app = express();
const port = process.env.PORT || 8080;
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
//app.use(morgan('dev'));
app.use(express.static(path.join(__dirname, 'public')));
app.listen(port, () => {
console.log(`server running at: http://localhost:${port}`);
});
app.get('/product/:productId',(req, res) =>{
const file = path.join(__dirname, 'public/index.html');
res.sendFile(file);
})
@stephencweiss
Copy link
Author

image
Load testing results when running on local machine - same machine that's hosting the proxy and the underlying services.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment