Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Fri Sep 08, 2017 1:40 pm 
Offline

Joined: Fri Sep 08, 2017 1:33 pm
Posts: 1
hello, I use varnish at port 80, apache2 8080 and nginx as proxy for ssl at 443.
the code I use in varnish/default.vcl
redirects http://domain.com -> https://www.domain.com
http://www.domain.com -> https://www.domain.com
but not https://domain.com -> https://www.domain.com
I searched over internet and tried to redirect in .htaccess, nginx, but no success. Is there any way to do this?

The code I used
Code:
sub vcl_recv {
 if ( (req.http.host ~ "^(?i)www.domain.com" || req.http.host ~ "^(?i)domain.com") && req.http.X-Forwarded-Proto !~ "(?i)https") {
          return (synth(750, ""));
     }
}
sub vcl_synth {
    if (resp.status == 750) {
        set resp.status = 301;
        set resp.http.Location = "https://www.domain.com" + req.url;
        return(deliver);
    }
}


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
RSS

Powered by phpBB® Forum Software © phpBB Group