# Auto-generated from app.openstack.surface.SERVICES
upstream openstack_simulator {
    server simulator:8080;
}

map $server_port $openstack_service {
    default   "simulator";
    5000      "keystone";
    8774      "nova";
    9696      "neutron";
    9292      "glance";
    8776      "cinder";
    8003      "placement";
    8004      "heat";
    8000      "heat-cfn";
    8080      "swift";
    6385      "ironic";
    9876      "octavia";
    9311      "barbican";
    8786      "manila";
    9001      "designate";
    9511      "magnum";
    9517      "zun";
    8779      "trove";
    8989      "mistral";
    8042      "aodh";
    8889      "cloudkitty";
    9090      "freezer";
    1234      "blazar";
    8999      "vitrage";
    15868      "masakari";
    9890      "tacker";
    5050      "adjutant";
    9322      "watcher";
    8888      "zaqar";
    80        "horizon";
    443       "https";
}

server {
    listen 5000;   # keystone (identity)
    listen 8774;   # nova (compute)
    listen 9696;   # neutron (network)
    listen 9292;   # glance (image)
    listen 8776;   # cinder (volumev3)
    listen 8003;   # placement (placement)
    listen 8004;   # heat (orchestration)
    listen 8000;   # heat-cfn (cloudformation)
    listen 8080;   # swift (object-store)
    listen 6385;   # ironic (baremetal)
    listen 9876;   # octavia (load-balancer)
    listen 9311;   # barbican (key-manager)
    listen 8786;   # manila (sharev2)
    listen 9001;   # designate (dns)
    listen 9511;   # magnum (container-infra)
    listen 9517;   # zun (container)
    listen 8779;   # trove (database)
    listen 8989;   # mistral (workflowv2)
    listen 8042;   # aodh (alarming)
    listen 8889;   # cloudkitty (rating)
    listen 9090;   # freezer (backup)
    listen 1234;   # blazar (reservation)
    listen 8999;   # vitrage (rca)
    listen 15868;   # masakari (instance-ha)
    listen 9890;   # tacker (nfv-orchestration)
    listen 5050;   # adjutant (admin-logic)
    listen 9322;   # watcher (infra-optim)
    listen 8888;   # zaqar (messaging)
    listen 80;

    server_name _;
    resolver 127.0.0.11 valid=10s ipv6=off;

    location / {
        proxy_pass http://openstack_simulator;
        proxy_http_version 1.1;
        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;
        proxy_set_header X-Forwarded-Port $server_port;
        proxy_set_header X-OpenStack-Service $openstack_service;
        # Console on :5000 may target another service via relative /v2.1|/v2.0|… paths.
        proxy_set_header X-OpenStack-Route-Service $http_x_openstack_route_service;
        proxy_set_header X-Request-ID $request_id;
        proxy_set_header OpenStack-API-Version $http_openstack_api_version;
        proxy_set_header X-OpenStack-Nova-API-Version $http_x_openstack_nova_api_version;
        add_header X-OpenStack-Service $openstack_service always;
        add_header Access-Control-Expose-Headers "X-Subject-Token,x-subject-token" always;
        add_header X-Forwarded-Port $server_port always;
    }
}

server {
    listen 443 ssl;
    server_name _;
    ssl_certificate /etc/nginx/tls/server.crt;
    ssl_certificate_key /etc/nginx/tls/server.key;
    ssl_protocols TLSv1.2 TLSv1.3;
    resolver 127.0.0.11 valid=10s ipv6=off;
    location / {
        proxy_pass http://openstack_simulator;
        proxy_http_version 1.1;
        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 https;
        proxy_set_header X-Forwarded-Port 443;
        proxy_set_header X-OpenStack-Service https;
        proxy_set_header X-Request-ID $request_id;
        add_header X-OpenStack-Service https always;
        add_header X-Forwarded-Port 443 always;
    }
}
