Dear all,
I recently added an SSL certificate to XNAT. However, when I try to log in using https://domain/Login.vm#!, it always redirects me to the HTTP URL (shows "unable to connect"). Manually changing the URL back to HTTPS allows me to access the home page. A similar issue occurs when logging out—an "unable to connect" error is displayed and redirect to the http url.
The nginx configuration is here:
server {
listen 443 ssl;
#listen 80;
server_name domain_name;
ssl_certificate /etc/ssl/certs/2024/cert.pem;
ssl_certificate_key /etc/ssl/private/2024/cert.key;
location / {
proxy_pass http://localhost:8080;
proxy_redirect http://localhost:8080 https://$host;
#proxy_redirect http://localhost: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 https;
proxy_set_header X-Forwarded-Port 443;
proxy_connect_timeout 150;
proxy_send_timeout 100;
proxy_read_timeout 100;
proxy_buffers 4 32k;
client_max_body_size 0;
client_body_buffer_size 128k;
}
}
Could you please assist with resolving this redirect issue?
Thank you.
Best,
Ruba
Thank you, Chidi.
I have added that section to the config file, but using the default_server parameter caused Nginx to fail loading, so I omitted it. The updated section is as follows. Unfortunately, I am still getting the same error.
Ruba, make sure you’ve set the site URL to the https version of the URL. If it’s still http://blah that would explain why it’s redirecting to that address rather than the secure version.
--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
xnat_discussi...@googlegroups.com.
To view this discussion visit
https://groups.google.com/d/msgid/xnat_discussion/e44b2160-2085-4731-a7b1-f883cbf8f74cn%40googlegroups.com.
Thank you for your input. I have already updated the site URL through the admin panel.
However, I am still encountering this issue where the link http://domain-name/app/template/Login.vm appears whenever I try to log in or log out of the system. So far, I have only made changes to the /etc/nginx/sites-enabled/xnat file. Are there any other configurations I should update?
Thank you for your guidance.
Best regards,
Ruba
Hi all,
Thank you for your help.
I just wanted to share the solution I found for this problem, in case others face something similar. The issue was related to configuring Tomcat to communicate with Nginx over HTTP while Nginx handles SSL termination. Here's what I did:
1. Updated the HTTP <Connector> in server.xml:I added the following under the <Host> section in server.xml to ensure Tomcat correctly interprets forwarded headers from Nginx:
After making these changes and restarting Tomcat and Nginx, everything worked as expected.
Best regards,
Ruba