Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In server.xml, at the Connector I specify proxyPort as 80.

Here's the xinetd service:

service http
{
        socket_type     = stream
        protocol        = tcp
        user            = tomcat6
        wait            = no
        bind            = 0.0.0.0
        port            = 80
        redirect        = 127.0.0.1 8080
        disable         = no
        flags           = REUSE
        log_type        = FILE /var/log/xinetd_http_access.log
        log_on_success  -= PID HOST DURATION EXIT

        per_source      = UNLIMITED
        instances       = UNLIMITED
}

Still, in the access logs of Tomcat I see lines like the following:

127.0.0.1 - - [17/Aug/2012:00:23:23 +0300] "GET / HTTP/1.1" 200 1975
127.0.0.1 - - [17/Aug/2012:00:23:23 +0300] "GET /_static/css/global.css HTTP/1.1" 304 -

Any ideas?

share|improve this question

Can xinetd pass an X-FORWARDED-FOR HTTP header?

If tomcat is behind a reverse proxy (e.g. nginx) that passes X-FORWARDED-FOR, i.e.:

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

Then you can set in your tomcat server.xml for the AccessLogValve:

pattern="%{X-Forwarded-For}i %l %u %t %r %s %b %{User-Agent}i %{Referer}i"

And you will get the originating IP address of the client in the access log.

Cheers

share|improve this answer
    
I guess I wasn't clear: There's xinetd (port 80). It forwards connections to Tomcat (port 8080). That's it. – Poni Aug 16 '12 at 21:53
1  
@Poni, Well if you want more than port redirection then you probably need to run a reverse proxy... – HTTP500 Aug 16 '12 at 21:58
    
Yea, got nginx. Will probably use that, eventually. Was just curious, maybe someone knows better you know. – Poni Aug 16 '12 at 22:01

Nope, nothing can be done. You cannot do this with xinetd. It appeared working for me, but then I realize that most of the IP addresses in the log are still 127.0.0.1.

I finally managed to get Tomcat running as (mostly) restricted user using jsvc with the --user option. It is also possible with iptables.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.