Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-02-28 18:49:40

dijjal
New Member
Registered: 2009-02-28
Posts: 5

TXP behind accelerator, logs not showing correct hosts

I’m trying to figure out how I can make Textpattern use the X-Forwarded-For data from traffic as all my traffic is passing through a varnish http accelerator. Right now all that is showing in the logs are the ip of the accelerator.

Any thoughts?

Last edited by dijjal (2009-02-28 19:04:40)

Offline

#2 2009-02-28 20:06:49

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: TXP behind accelerator, logs not showing correct hosts

Actually, Textpattern contains code to detect proxies. Alas, it seems to be lacking in your context.

Please execute these steps to provide more information:

Create an article with this body contents:

= START =
<txp:php>
dmp('RA', serverSet('REMOTE_ADDR')).n;
dmp('SA', serverSet('SERVER_ADDR')).n;
dmp('FF', serverSet('HTTP_X_FORWARDED_FOR')).n;
</txp:php>
= END =

In this article’s “Advanced options”, set “Article markup” to “Leave text untouched”. Visit this article and report the body output between = START = and = END =.

Offline

#3 2009-03-11 20:15:57

dijjal
New Member
Registered: 2009-02-28
Posts: 5

Re: TXP behind accelerator, logs not showing correct hosts

Thanks for your reply! Sorry for the long delay, was expecting email notification of any replies.

This is the information it spits out:

= START =

RA 10.3.1.xx
SA 10.3.1.xx
FF 193.157.254.xxx

= END =

where the last bit of information is my correct IP. Promising I guess? :)

Offline

#4 2009-03-12 07:21:46

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: TXP behind accelerator, logs not showing correct hosts

What version of Textpattern are you using?

Offline

#5 2009-03-12 11:45:21

dijjal
New Member
Registered: 2009-02-28
Posts: 5

Re: TXP behind accelerator, logs not showing correct hosts

4.0.7

Offline

#6 2009-03-12 11:57:45

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: TXP behind accelerator, logs not showing correct hosts

Support for X-Forwarded-For was introduced in 4.0.7, so this is ok.

Is the proxy’s IP address recorded in the “host” or in the “ip” column (or both) of the log?

Offline

#7 2009-03-12 12:00:38

dijjal
New Member
Registered: 2009-02-28
Posts: 5

Re: TXP behind accelerator, logs not showing correct hosts

It’s recorded in both. IP address in IP column and hostname of the Varnish proxy in the host column. The hostname of the proxy is a local non-resolving one if it makes any difference.

Last edited by dijjal (2009-03-12 12:23:56)

Offline

#8 2009-04-16 11:40:40

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: TXP behind accelerator, logs not showing correct hosts

I cannot reproduce your symptom, fwiw – everything looks so rosy. We’ll have to poke around a little bit more, I suspect.

  1. If this is a viable option, TRUNCATE txp_log and record another visit.
  2. Set “Use DNS lookup in visitor logs?” to “No” in Preferences, and see whether it changes anything.

Offline

Board footer

Powered by FluxBB