Docker, NGINX, Shiny-Server, SSL - Page rendering issue

Hi everyone,

I'm currently working in a docker environment leveraging to bring SHINY to life.

Docker, and docker-compose.
Nginx:latest
rocker/shiny-verse
certbot/certbot

When I run Nginx as a reverse proxy to Shiny, it works just fine. I see the default welcome screen with the working apps on the right hand side.

When I implement my certbot image, configuration files, and SSL keys, I see the same welcome screen, but only text renders. See screenshot.

Here is my docker-compose.yml file:

version: '3'

services:
  nginx:
    image: nginx
    container_name: webserver
    restart: unless-stopped
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./data/nginx/conf/nginx.conf:/etc/nginx/nginx.conf
      - ./data/certbot/conf:/etc/letsencrypt
      - ./data/certbot/www:/var/www/certbot
  shiny:
    image: rocker/shiny-verse
    container_name: shiny
    restart: unless-stopped
    expose:
      - 3838

  certbot:
    image: certbot/certbot
    container_name: cert
    volumes:
      - ./data/certbot/conf:/etc/letsencrypt
      - ./data/certbot/www:/var/www/certbot
    entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"

Here is my Nginx.conf file:

events { }

http {

  map $http_upgrade $connection_upgrade {
      default upgrade;
      ''      close;
    }

  server {
    listen 80;
    server_name <my.domain.here.com>;
    return 301 https://<my.domain.here.com>$request_uri;
         }

   server {
    listen 443 ssl;
    server_name <my.domain.here.com>;
    ssl_certificate /etc/letsencrypt/live/<my.domain.here.com>/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/<my.domain.here.com>/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
    access_log /var/log/nginx/data-access.log combined;

    location / {
       proxy_pass http://shiny:3838/;
       proxy_set_header X-Real-IP  $remote_addr;
       proxy_set_header X-Forwarded-For $remote_addr;
       proxy_set_header Host $host;

       proxy_redirect http://shiny:3838/ $scheme://$http_host/;
       proxy_http_version 1.1;
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection $connection_upgrade;
       proxy_read_timeout 20d;
       proxy_buffering off;
       }
   }
}

Really, any pointers, suggestions is greatly appreciated. Been trying for a couple days combing through everything before I jumped on for help.

Thanks!

I fixed it. I just added

proxy_set_header    X-Forwarded-Proto $scheme;

to my Nginx.conf file

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.