MonashBI/xnat-docker-compose

HTTPS over Localhost - Redirecting back to HTTP

Opened this issue · 0 comments

I am trying to deploy XNAT on https://localhost because I have other dependencies that need SSL (and I need to test on localhost).

When I try to navigate to https://localhost, it redirects me to http://localhost/app/template/Login.vm.

image

image

Then, I can add the s and go to https://localhost/app/template/Login.vm and view the login page
image

Once I login, I am redirected again to http://localhost
image

Now, I can just type in the url https://localhost/app/template/Index.vm?login=true and I am logged in successfully and I can navigate XNAT without any redirections
image

Can somebody help me figure out what is wrong with my nginx config? Or should I be looking at xnat-web ?

#user www-data;
worker_processes auto;
events {
  worker_connections 1024;
  # multi_accept on;
}
http {
  ##
  # Basic Settings
  ##
  sendfile on;
  tcp_nopush on;
  tcp_nodelay on;
  keepalive_timeout 65;
  types_hash_max_size 2048;
  # server_tokens off;
  # server_names_hash_bucket_size 64;
  # server_name_in_redirect off;
  #include /etc/nginx/mime.types;
  default_type application/octet-stream;
  ##
  # SSL Settings
  ##
  #ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
  #ssl_prefer_server_ciphers on;
  ##
  # Logging Settings
  ##
  access_log /var/log/nginx/access.log;
  error_log /var/log/nginx/error.log;
  ##
  # Gzip Settings
  ##
  gzip on;
  gzip_disable "msie6";
  ##
  # Virtual Host Configs
  ##
  #include /etc/nginx/conf.d/*.conf;
  #include /etc/nginx/sites-enabled/*;
server {
  listen 80 default_server;
  listen [::]:80 default_server;
  server_name xnat-web;
  return 301 https://$server_name$request_uri;
}
  server {

        listen 443 ssl;
        server_name xnat-web;
        ssl on;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

        ssl_certificate     /etc/ssl/xnat/localhost.pem;
        ssl_certificate_key /etc/ssl/xnat/localhost-key.pem;

        root /var/lib/tomcat7/webapps/ROOT;

        proxy_set_header Host $host;

        location / {

        proxy_pass                          http://xnat-web:8080;
        proxy_redirect                      http://xnat-web:8080 $scheme://localhost;
        proxy_set_header Host               $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto  $scheme;

        #proxy_intercept_errors  on;
        proxy_connect_timeout 3000;
        proxy_send_timeout 2000;
        proxy_read_timeout 2000;
        proxy_buffers 4 32k;
        client_max_body_size 0;
        client_body_buffer_size 128k;
    }

    large_client_header_buffers 8 80k;

    access_log /var/log/nginx/xnat.access.log;
    error_log /var/log/nginx/xnat.error.log;
}
}