WebFaction
Community site: login faq

I'm working on serving up a website using Node.js and Express. One issue I'm having is getting the client browser's IP address logged -- it's consistently coming up as 127.0.0.1. I'm assuming there's something with the way Webfaction is routing the request as I can get it working on my development machine.

I'm using the Connect middleware for logging, and using either the default format string, which uses ":remote-addr", or a custom format string that uses ":res[x-forwarded-for]", both of which give me only 127.0.0.1 as the resulting address.

Has anyone else experienced this? Anyone know of a workaround or a different token to use in the format string?

Thanks.

asked 02 Jan '14, 05:43

rsgoheen
3114
accept rate: 0%

edited 04 Jan '14, 02:23


I think you need to enable "trust proxy" in your express settings. See the following URLs for more info:

Hope that helps!

permanent link

answered 02 Jan '14, 16:38

seanf
12.2k41836
accept rate: 37%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×34
×12
×10

question asked: 02 Jan '14, 05:43

question was seen: 14,432 times

last updated: 04 Jan '14, 02:23

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM