How to solve this problem? After I connected the unicorn to the production server in my logs it is clear that all requests to the application go through ip 127.0.0.1 and even Devise registers current_sign_in_ip as 127.0.0.1
Started GET "/users/sign_in" for 127.0.0.1 at 2016-03-22 09:09:35 +0100 Started GET "/" for 127.0.0.1 at 2016-03-22 09:09:39 +0100
nginx.conf
worker_processes 1; error_log logs/error.log; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; gzip on; upstream app_production { server unix:/tmp/unicorn.app_production.sock fail_timeout=0; } server { listen 80; server_name app.exemple.com; root /home/deployer/app_production/current/public; rails_env production; client_max_body_size 50M; location ^~ /assets/ { gzip_static on; expires max; add_header Cache-Control public; } try_files $uri/index.html $uri @app_production; location @app_production { proxy_set_header X-Forwared-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://app_production; } } }