Everything works now. Finally. added 3 more rules to nginx configuration file.
my nginx.conf file now looks like:
server {
listen 80;
listen [::]:80;
server_name forum.domain.org;
return 301 https://forum.domain.org$request_uri;
}
server {
listen 443 ssl spdy;
listen [::]:443 ssl spdy;
server_name forum.domain.org;
keepalive_timeout 70;
gzip on;
ssl_certificate /etc/ssl/domain.crt;
ssl_certificate_key /etc/ssl/domain.key;
ssl_protocols TLSv1.1 TLSv1.2;
ssl_ciphers EECDH+AESGCM:EDH+AESGCM:ECDHE-RSA-AES128-GCM-SHA256:AES256+EECDH:DHE-RSA-AES128-GCM-SHA256:AES256+EDH:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4;
ssl_dhparam /etc/nginx/conf.d/dhparam.pem;
ssl_prefer_server_ciphers on;
ssl_session_tickets off;
ssl_session_cache shared:SSL:10m;
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; ";
add_header X-Frame-Options "DENY";
spdy_headers_comp 6;
spdy_keepalive_timeout 300;
access_log /var/log/nginx/localhost.access.log;
location / {
rewrite /(.*) /$1 break;
proxy_pass http://forum.domain.org:25654/;
proxy_read_timeout 90;
proxy_redirect http://forum.domain.org:25654/ https://forum.domain.org/;
#Adding below rules solved the problem
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
I hope it can help others as well. Thank you @mpalmer @riking
P.S: I am not using any iptable rules to forward the traffic. The rules I implemented above, I have removed them.