Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

I'm getting crazy with AWS ELB and my instances.

My infrastructure is made by:

                --> NGINX --> node.js | Apache
Users --> ELB <
                --> NGINX --> node.js | Apache

My problem is that some of the users are getting 403 response from their requests. What makes me crazy is that other users get 200 response and works perfectly. This users work great with a non balanced instance.

That's an example of one my location proxy

location ~* ^\/api\/1.0\/download {
  proxy_set_header X-Forwarded-Host $host;
  proxy_set_header X-Forwarded-Server $host;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_pass http://localhost:3105;
  proxy_read_timeout 90;

http {
     real_ip_header X-Forwarded-For;

     include       /etc/nginx/mime.types;
     default_type  application/octet-stream;

     log_format  main  '$remote_addr|$time_local|"$request"|'

     log_format traffic '$msec|$bytes_sent|$request_length|$http_referer|$remote_addr|$uri';

     access_log  /mnt/logs/access.log main;
     access_log  /mnt/logs/trafficNginx.log traffic;

     sendfile    on;

     tcp_nopush  on;

     keepalive_timeout  0;
     tcp_nodelay        on;

     gzip         on;
     #gzip_disable "MSIE [1-6]\.(?!.*SV1)";

     include /etc/nginx/conf.d/*.conf;

Proxy settings:

   proxy_redirect          off;
   client_max_body_size    10m;
   client_body_buffer_size 128k;
   proxy_connect_timeout   90;
   proxy_send_timeout      90;
   proxy_read_timeout      90;
   proxy_buffers           32 4k;

   proxy_set_header        Host $host;

   proxy_set_header        X-Real-IP $remote_addr;

   proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;


share|improve this question
The logs may have a clue. Do you see why they would get these errors? – Nathan C Jun 3 '13 at 16:03
Have you tested all backend instances directly? – jeffatrackaid Jun 3 '13 at 17:50
Yes, if I make the requests directly to my instance they get 200 on everything. I don't understand why some of the clients get 403 and other 200 within the same infrastructure – enedebe Jun 4 '13 at 6:06
Are the requests authenticated? Is the user session cached on disk somewhere? Are you using sticky sessions in ELB to ensure that the user is stuck to the same server that they're authenticated to? – chrskly Jun 5 '13 at 17:23
I've found my problem, it wasn't the configuration. Well, the configuration was right, I had a allow only from my ip and not for the rest of the internet. That's the problem when you use protected development policies. Thanks for all. – enedebe Jun 6 '13 at 19:10

Your Answer


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

Browse other questions tagged or ask your own question.