Skip to content

host not found in up stream #127

@cedvdb

Description

@cedvdb

I'm trying to run nginx as a reverse proxy inside docker. The issue is that nginx is exiting because it doesn't find the host in upstream (nginx strts faster than keycloak I assume) so it just exits.

docker compose

 version: '2'
 services:
  keycloak:
    image: jboss/keycloak-postgres
    ports:
      - "8080:8080"
  nginx:
    build:
      context: ./nginx
      dockerfile: dockerfile
    ports:
      - "80:80"
      - "443:443"
    depends_on:
      - keycloak
    entrypoint: ['sleep', '25']
 > nginx conf
  server {
    listen 80;

    location / {
      index index.html;
      root /usr/share/nginx/html;
    }

    location /auth {
      proxy_pass http://keycloack:8080/auth;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
    }
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions