EGA-archive / beacon2-ri-api

Beacon v2 Reference Implementation (API)
Apache License 2.0
16 stars 38 forks source link

Feature ssl offload reverse proxy nginx #308

Closed iper-jkane closed 3 months ago

iper-jkane commented 5 months ago

Nginx ssl offloading / reverse proxy for beacon, beacon-permissions and frontend services.

costero-e commented 5 months ago

Hi @iper-jkane, though I admit I'm not proficient in nginx (trying to), I haven't suceed to run your proposal with a SSL on top. But a solution from GDI (Sweden) for Beacon they made was creating a nginx container on top of beacon:

  nginx:
    image: nginx:mainline-alpine3.17-slim
    depends_on:
      beacon:
        condition: service_started
    ports:
      - 5050:443
    volumes:
      - ./tls_nginx.conf:/etc/nginx/conf.d/default.conf:ro
      - ./cert.pem:/etc/nginx/mock-cert.pem
      - ./privkey.pem:/etc/nginx/mock-key.pem
    networks:
      - my-app-network

Then creating the nginx conf file like this:

server {
    listen              443 ssl;
    server_name         localhost;
    ssl_certificate     /etc/nginx/mock-cert.pem;
    ssl_certificate_key /etc/nginx/mock-key.pem;

    location / {
    proxy_pass http://beacon:5050/;
    }

}

And this works for me. I don't know if you need your approach better than this but if you haven't tried it, maybe you can and then give me your feedback.

Thanks, Oriol