Help with nginx running on AWS Fargate and hitting an S3 Website bucket

Alan.Andrea at Alan.Andrea at
Sun Oct 13 23:06:42 UTC 2019


I am having a lot of issues attempting to run NGINX on Fargate whereby I am getting a 502 bad gateway error when hitting
My listener   that should be doing a proxy-pass to an S3 website bucket that I created.
I am not sure if this is due to NGINX being unable to do the nameserver  resolving even though
I have specified a resolver at both the server level and at the listener level. Neither of which work. ( using googles public nameserver:
Also, I used the standard docker image for NGINX obtained from the NGINX website.
The S3 website bucket is public also just to mention and is serving up the site without issues.

This is the error that I get:

<< Actual hostnames removed for privacy concerns>>
2019/10/12 17:30:45 [error] 7#7: 3 could not be resolved (110: Operation timed out), client:, server: somehost at<mailto:somehost at>, request: "GET /login/ HTTP/1.1", host: somehost at<mailto:somehost at>

If anyone has a successful example of running  NGINX on Fargate and hitting and S3 website, please let me know.


Here is my nginx.conf file:

user  nginx;
worker_processes  1;

error_log  /dev/stdout debug;
pid        /var/run/;

events {
    worker_connections  1024;

http {

    server_names_hash_bucket_size 256;
    server_names_hash_max_size 512;

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

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /dev/stdout  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

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

    index index.html;

  server {
        listen 80;
        server_name   *.someserver at<mailto:*.someserver at>;
        access_log /dev/stdout;
        error_log /dev/stdout;

        location /login/ {

             set $bucket "";

             rewrite ^([^.]*[^/])$ $1/ permanent;

             proxy_pass http://$bucket;

             proxy_redirect off;
             proxy_set_header Host $bucket;
             proxy_set_header X-Real-IP $remote_addr;
             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
             proxy_hide_header x-amz-id-2;
             proxy_hide_header x-amz-request-id;




This e-mail is for the sole use of the intended recipient and contains information that may be privileged and/or confidential. If you are not an intended recipient, please notify the sender by return e-mail and delete this e-mail and any attachments. Certain required legal entity disclosures can be accessed on our website.<>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx-devel mailing list