'ERR_TOO_MANY_REDIRECTS' error nginx docker

I am using nginx docker for deploying my app in aws server. I have to access my api using nginx proxy url which looks like https://domain.com/api/. This is a https request so i have to set proxy redirection to another port where api service running and the service is running under another docker container in same server instance. so my nginx conf file looks like below,

    server {
       listen         80;
       server_name    domain.com;
       return         301 https://$server_name$request_uri;

server {
       listen         443 ssl;
       server_name    domain.com;
       # add Strict-Transport-Security to prevent man in the middle attacks
       add_header Strict-Transport-Security "max-age=31536000";
       location /api/ {
            proxy_pass http://my-public-ip-address:3000;


So my problem is that while I am trying to access the api endpoint using above url its showing ERR_TOO_MANY_REDIRECTS. So any one know about this issue? And also i went through all the article with same issue mentioned but no luck.

  • There is a circular dependency in the target dependency graph involving target “DockerBuildServiceReferences”
  • Docker swarm on 'dind' images and networking problems
  • Static webpage on Nginx Docker Container Missing CSS
  • How to force application's stdout logs through uwsgi?
  • Docker automated build from private bitbucket repo: Failed to clone repository
  • Local Java App not running on HBase/Phoenix Docker image
  • Spark app unable to write to elasticsearch cluster running in docker
  • Docker Compose + Rails: best practice to migrate?
  • How to rate-limit upload from docker container?
  • What would be a good docker webdev workflow?
  • How to setup a valid mongo replicaset
  • How create MongoDB cluster on Kubernetes?
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.