Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have this configuration in my Apache virtualhost :

<VirtualHost *:80>
        ServerAdmin contact@black-frames.net
        ServerName black-frames.net

        ProxyPreserveHost On
        ProxyPass / http://127.0.0.1:9150/
        ProxyPassReverse / http://127.0.0.1:9150/
        ErrorLog /var/log/apache2/blackframes_error.log
        LogLevel warn
        CustomLog /var/log/apache2/blackframes_access.log combined

        ServerSignature Off
</VirtualHost>

But on Play Framework, asking for the client IP (request.remoteAddress) results in a 127.0.0.1.

I'm sure it's because of the proxy, but I don't know which parameter to set to make this works.

Thanks for your help !

share|improve this question

1 Answer 1

up vote 2 down vote accepted

When using a proxy server, you need to look at the X-Forwarded-For header instead of the remote address (source IP).

share|improve this answer
    
Exactly! That was the way to look. But I had to add XForwardedSupport=127.0.0.1 in the application.conf file to make this works. You set me on the right track. Thanks! –  Cyril N. Apr 17 '12 at 11:47
    
Nice to hear that from you! –  Khaled Apr 17 '12 at 11:50

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.