Use the right header for remote IPs

This commit is contained in:
Jonathan Cremin 2016-08-07 20:41:21 +01:00
parent 2c577cb7ae
commit ffa01ba586
5 changed files with 5 additions and 5 deletions

View file

@ -8,7 +8,7 @@ const badLoginMsg = '{"error": {"message": "Incorrect login details.", "code": 6
export default function* (next) {
let user = false;
const remoteIp = this.req.headers['x-real-ip'] || this.req.connection.remoteAddress;
const remoteIp = this.req.headers['x-forwarded-for'] || this.req.connection.remoteAddress;
const login = yield models.login.create({
ip: remoteIp,
successful: false,

View file

@ -14,7 +14,7 @@ const fromname = process.env.EMAIL_NAME;
export function* create() {
const stripeToken = this.request.body.stripeToken;
const ip = this.request.headers['x-real-ip'] || this.req.connection.remoteAddress;
const ip = this.request.headers['x-forwarded-for'] || this.req.connection.remoteAddress;
const createCustomer = {
card: stripeToken.id,