Skip to Content
Menu
This question has been flagged
1791 Views

getting http://doain\.com\ instead\ of\ https://domain\.com\ http\ redirection\ issue\ using\ nginx\.

added\ "https://domain\.com"\ url\ in\ developer\ console\ and\ also\ in\ web\.base\.url\ sytem\ parameters\.

and\ in\ config\ file\ i\ set\ proxy_mode=\ true

and\ below\ is\ my\ nginx\ config\ file\.

server\ \{
\ \ \ \ server_name\ vidya24\.com\ www\.domain\.com;
\ \ \ \ client_max_body_size\ 2048M;
\ \ \ \ proxy_read_timeout\ 10000000;
\ \ \ \ proxy_connect_timeout\ 100000000;
\ \ \ \ expires\ 0;
\ \ \ \ \ location\ /\ \{
\ \ \ \ \ \ \ proxy_pass\ http://127\.0\.0\.1:8069;
\ \ \ \ \}

\ \ \ \ if\ \(\$host\ =\ 'www\.domain\.com'\)\ \{
\ \ \ \ \ \ \ \ return\ 301\ https://domain\.com\$request_uri;
\ \ \ \ \}

\ \ \ \ proxy_set_header\ Host\ \$host;
\ \ \ \ proxy_set_header\ X\-Real\-IP\ \$remote_addr;
\ \ \ \ proxy_set_header\ X\-Forward\-For\ \$proxy_add_x_forwarded_for;
\ \ \ \ \#\ Let\ the\ OpenERP\ web\ service\ know\ that\ we're\ using\ HTTPS,\ otherwise\
\ \ \ \ \#\ it\ will\ generate\ URL\ using\ http://\ and\ not\ https://
\ \ \ \ proxy_set_header\ X\-Forwarded\-Proto\ https;\ \
\ \ \ \ listen\ 443\ ssl;\ \#\ managed\ by\ Certbot
\ \ \ \ ssl_certificate\ /etc/letsencrypt/live/www\.domain\.com/fullchain\.pem;\ \#\ managed\ by\ Certbot
\ \ \ \ ssl_certificate_key\ /etc/letsencrypt/live/www\.domain\.com/privkey\.pem;\ \#\ managed\ by\ Certbot
\ \ \ \ include\ /etc/letsencrypt/options\-ssl\-nginx\.conf;\ \#\ managed\ by\ Certbot
\ \ \ \ ssl_dhparam\ /etc/letsencrypt/ssl\-dhparams\.pem;\ \#\ managed\ by\ Certbot


\}

server\ \{
\ \ \ \ if\ \(\$host\ =\ domain\.com\)\ \{
\ \ \ \ \ \ \ \ return\ 301\ https://\$host\$request_uri;
\ \ \ \ \}\ \#\ managed\ by\ Certbot


\ \ \ \ if\ \(\$host\ =\ www\.domain\.com\)\ \{
\ \ \ \ \ \ \ \ return\ 301\ https://domain\.com\$request_uri;
\ \ \ \ \}\ \#\ managed\ by\ Certbot
\ \ \ \ proxy_set_header\ Host\ \$host;
\ \ \ \ proxy_set_header\ X\-Real\-IP\ \$remote_addr;
\ \ \ \ proxy_set_header\ X\-Forward\-For\ \$proxy_add_x_forwarded_for;
\ \ \ \ \#\ Let\ the\ OpenERP\ web\ service\ know\ that\ we're\ using\ HTTPS,\ otherwise\ \ \ \ \ \ \ \
\ \ \ \ \#\ it\ will\ generate\ URL\ using\ http://\ and\ not\ https://
\ \ \ \ proxy_set_header\ X\-Forwarded\-Proto\ https;
\ \ \
\ \ \ \ listen\ 80;
\ \ \ \ server_name\ vidya24\.com\ www.domain.com;
return 404; # managed by Certbot




}

Avatar
Discard
Related Posts Replies Views Activity
0
Dec 24
33
0
Nov 23
278
2
Oct 23
1681
1
Jul 23
2440
0
Jun 23
1472