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

HTTPS over Localhost - Redirecting back to HTTP #22

Open
aditsanghvi94 opened this issue Aug 25, 2020 · 0 comments
Open

HTTPS over Localhost - Redirecting back to HTTP #22

aditsanghvi94 opened this issue Aug 25, 2020 · 0 comments

Comments

@aditsanghvi94
Copy link

aditsanghvi94 commented Aug 25, 2020

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;
}
}

@aditsanghvi94 aditsanghvi94 changed the title HTTPS over Localhost - Redirecting back to http? [Feature Request] HTTPS over Localhost Aug 25, 2020
@aditsanghvi94 aditsanghvi94 changed the title [Feature Request] HTTPS over Localhost HTTPS over Localhost - Redirecting back to HTTP Aug 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant