tag:blogger.com,1999:blog-8404509726009905633.post8928921932162694502..comments2023-10-09T14:15:54.979+03:00Comments on Mind Reference: How to rewrite all to https in nginxAndriy Kornatskyyhttp://www.blogger.com/profile/04890869628175359888noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-8404509726009905633.post-61415503423652428222013-10-10T16:16:25.749+03:002013-10-10T16:16:25.749+03:00+1+1Lingnoreply@blogger.comtag:blogger.com,1999:blog-8404509726009905633.post-63210926882198434022012-12-12T22:52:07.928+02:002012-12-12T22:52:07.928+02:00The return rocks. Thanks. But for somehow I have t...The return rocks. Thanks. But for somehow I have to put server_name for the server *:80 to make it work...Leckyhttps://www.blogger.com/profile/09497735078942018149noreply@blogger.comtag:blogger.com,1999:blog-8404509726009905633.post-37330317409512283892012-11-28T20:43:17.524+02:002012-11-28T20:43:17.524+02:00In both cases there is issued permanent redirect, ...In both cases there is issued permanent redirect, thus browser is instructed to use https location forward. I have updated post with nginx return directive.Andriy Kornatskyyhttps://www.blogger.com/profile/04890869628175359888noreply@blogger.comtag:blogger.com,1999:blog-8404509726009905633.post-54452000302202431862012-11-28T20:17:25.477+02:002012-11-28T20:17:25.477+02:00Your example is very expensive in terms of resourc...Your example is very expensive in terms of resources, because every single request which comes in needs to go through the "if" statement. I would do like:<br /><br />return 301 https://$server_name$request_uri;Vaidas Jablonskishttps://www.blogger.com/profile/03774571527205810122noreply@blogger.comtag:blogger.com,1999:blog-8404509726009905633.post-58281631538192618392012-10-10T17:51:07.000+03:002012-10-10T17:51:07.000+03:00Thanks for posting this. I recently merged http/ht...Thanks for posting this. I recently merged http/https sections and couldn't recall the syntax for checking whether a request was via http and https and Google brought me here.<br /><br />Thanks again.deorenhttp://www.whyaskwhy.org/blog/noreply@blogger.com