The Wayback Machine - https://web.archive.org/web/20200706140757/https://github.com/nginx-proxy/nginx-proxy/issues/1421
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxying two virtual hosts on the same machine routes to only one of them #1421

Open
adrianblakey opened this issue Apr 15, 2020 · 1 comment
Open

Comments

@adrianblakey
Copy link

@adrianblakey adrianblakey commented Apr 15, 2020

I have a couple of Spring Cloud Config servers behind the proxy. Queries to either server are only dispatched to one of them - illustrated by a similar response (the dit server is configured to DIT git repo. organization, not the Development git organization).

Any ideas, or is this a defect?

$ curl -k https://serviceconfigdit/foo/application
{"name":"foo","profiles":["application"],"label":null,"version":"a1c4f51b753939c8ee10c392f3a0b236c97b659c","state":null,"propertySources":[{"name":"https://rc-github.dd.ent/Development/spring-config-server/foo.properties","source":{"foo":"from foo props","democonfigclient.message":"hello spring io dev"}}]}

$ curl -k https://serviceconfig**dev**/foo/application
{"name":"foo","profiles":["application"],"label":null,"version":"a1c4f51b753939c8ee10c392f3a0b236c97b659c","state":null,"propertySources":[{"name":"https://rc-github.dd.ent/Development/spring-config-server/foo.properties","source":{"foo":"from foo props","democonfigclient.message":"hello spring io dev"}}]}

Only the docker log for the dev server shows the query (confirming the dit request is routed to dev):

2020-04-15 09:21:29.792 INFO 10 --- [nio-8888-exec-4] o.s.c.c.s.e.NativeEnvironmentRepository : Adding property source: file:/tmp/config-repo-795975480269575774/foo.properties
2020-04-15 09:21:43.322 INFO 10 --- [nio-8888-exec-8] o.s.c.c.s.e.NativeEnvironmentRepository : Adding property source: file:/tmp/config-repo-795975480269575774/foo.properties

The nginx proxy is a derived image with the larger buffer set. All the images come up and run and are healthy. The certs are good and named conventionally to the DNS mapped names (serviceconfigdev.dd.ent and serviceconfigdit.dd.ent crt/key). The certs are locally generated SAN certs.

The hostname on which it's running is 10.6.253.128 and it's mapped in the DNS to it's fqdn and the names: serviceconfigdit.dd.ent and serviceconfigdev.dd.ent and serviceconfig - which is not used - I have checked they are set correctly.

$ nslookup                                                
> nnnn                                                                    
Server:         10.1.128.12                                                    
Address:        10.1.128.12#53                                                 
                                                                               
Name:   nnnn.ut.dd.lab                                              
Address: 10.6.253.128                                                          
> serviceconfig                                                                
Server:         10.1.128.12                                                    
Address:        10.1.128.12#53                                                 
                                                                               
serviceconfig.dd.ent       canonical name = nnnn.ut.dd.lab.    
Name:   nnnn.ut.dd.lab                                              
Address: 10.6.253.128                                                          
> serviceconfigdit                                                             
Server:         10.1.128.12                                                    
Address:        10.1.128.12#53                                                 
                                                                               
serviceconfigdit.dd.ent    canonical name = nnnn.ut.dd.lab.    
Name:   nnnn.ut.dd.lab                                              
Address: 10.6.253.128                                                          
> serviceconfigdev                                                             
Server:         10.1.128.12                                                    
Address:        10.1.128.12#53                                                 
                                                                               
serviceconfigdev.dd.ent    canonical name = nnnn.ut.dd.lab.    
Name:   nnnn.ut.dd.lab                                              
Address: 10.6.253.128                                                          
>  
docker ps -a
CONTAINER ID        IMAGE                              COMMAND                  CREATED             STATUS              PORTS                                      NAMES
f69e21d56d1d        spring-cloud-config-server:1.0.0   "/usr/app/run.sh"        46 hours ago        Up 46 hours         0.0.0.0:8889->8889/tcp                     config-server-dit
60994a6ae73c        spring-cloud-config-server:1.0.0   "/usr/app/run.sh"        46 hours ago        Up 46 hours         0.0.0.0:8888->8888/tcp                     config-server-dev
bf29d4c6c539        spring-cloud-nginx-proxy           "/app/docker-entrypo…"   46 hours ago        Up 46 hours         0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   nginx-proxy
version: '2'

services:
  nginx-proxy:
    restart: always
    container_name: nginx-proxy
    image: ${DOCKER_REGISTRY}/spring-cloud-nginx-proxy
    ports:
      - "80:80"
      - "443:443"
    networks:
      - confignet
    environment:
      - HTTPS_METHOD=redirect
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - certs:/etc/nginx/certs

  config-server-dev:
    restart: always
    container_name: config-server-dev
    image: ${DOCKER_REGISTRY}/${IMAGE_NAME}:${VERSION}
    ports:
      - "8888:8888"
    expose:
      - 8888
    networks:
      - confignet
    environment:
      - VIRTUAL_HOST=serviceconfigdev.dd.ent
      - NETWORK_ACCESS=internal
      - SERVER_PORT=8888
      - JAVA_OPTS=
      - SPRING_CLOUD_CONFIG_SERVER_GIT_URI=https://rc-github.dd.ent/Development/spring-config-server
    depends_on:
      - nginx-proxy

  config-server-dit:
    restart: always
    container_name: config-server-dit
    image: ${DOCKER_REGISTRY}/${IMAGE_NAME}:${VERSION}
    ports:
      - "8889:8889"
    expose:
      - 8889
    networks:
      - confignet
    environment:
      - VIRTUAL_HOST=serviceconfigdit.deltads.ent
      - NETWORK_ACCESS=internal
      - SERVER_PORT=8889
      - JAVA_OPTS=
      - SPRING_CLOUD_CONFIG_SERVER_GIT_URI=https://rc-github.dd.ent/DIT/spring-config-server
    depends_on:
      - nginx-proxy

networks:
  confignet:
    driver: bridge

volumes:
  certs:
               
@tuxmainy
Copy link

@tuxmainy tuxmainy commented May 1, 2020

You could have a look at the generated nginx configuration to get an idea what went wrong or post ist here :)

docker exec -it nginx-proxy_1 cat /etc/nginx/conf.d/default.conf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.