Body: <p>I've got a site set up with the <a href="https://plugins.craftcms.com/patrol" rel="nofollow noreferrer">Patrol plugin</a>, and it forces the HTTPS and www on most pages fine. I've got the <code>sslRoutingBaseUrl</code>, <code>sslRoutingEnabled</code>, and <code>sslRoutingRestrictedUrls</code> set in my general.php config file (just like in the <a href="https://github.com/selvinortiz/craft-plugin-patrol#configure" rel="nofollow noreferrer">github example</a>). It works 99% of the time.</p>
  
  <p>But it doesn't work right for 404s.</p>
  
  <p>Normally, when I go to a page, it automatically changes from <a href="http://mysite.com/mypage" rel="nofollow noreferrer">http://mysite.com/mypage</a> to <a href="https://www.mysite.com/mypage" rel="nofollow noreferrer">https://www.mysite.com/mypage</a></p>
  
  <p>But when I got to a broken page, <a href="http://mysite.com/brokenpageurl" rel="nofollow noreferrer">http://mysite.com/brokenpageurl</a>, it doesn't redirect.</p>
  
  <p>My 404.twig template lives in the root of the templates directory. So if I go to mysite.com/404, it automatically redirects to <a href="https://www.mysite.com/404" rel="nofollow noreferrer">https://www.mysite.com/404</a> - because it's a real page.</p>
  
  <p>But when another page exits to a 404, it doesn't redirect.</p>
  
  <p>I'm wondering if the 'exit to 404' rendering bit happens before patrol gets a chance to do its redirect.</p>
  
  <p>On Craft 3.3.19 and Patrol 3.1.3. But I can reproduce the issue on a couple of different sites. </p>
  
  <p>Edit: I made <a href="https://github.com/selvinortiz/craft-plugin-patrol/issues/21" rel="nofollow noreferrer">a ticket on github</a> too.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-01-09T00:41:20.653Z
Comments.Text: I was going to suggest creating an issue on their repo, but it looks like you beat me to it. :) https://github.com/selvinortiz/craft-plugin-patrol/issues/21
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-01-10T15:03:12.660Z
Comments.Text: I'd suggest enforcing things like SSL/non-SSL and www./non-www. in your webserver's config rather then via a plugin. [Apache rewrite http to https](https://cwiki.apache.org/confluence/display/httpd/RewriteHTTPToHTTPS) -- [Nginx rewrite http to https](https://bjornjohansen.no/redirect-to-https-with-nginx)
Comments.UserDisplayName: andrew.welch
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-01-27T15:23:46.253Z
Comments.Text: Seeing no bites here or on my github issue, I put rewrite rules into my .htaccess file.
Comments.UserDisplayName: SamC
Tags: <craft3>
Title: Patrol not forcing https on 404 pages
ThreadText: # Patrol not forcing https on 404 pages
  
  (Asked by: username_0 on 2020-01-08)
  
  I've got a site set up with the [Patrol plugin](https://plugins.craftcms.com/patrol), and it forces the HTTPS and www on most pages fine. I've got the `sslRoutingBaseUrl`, `sslRoutingEnabled`, and `sslRoutingRestrictedUrls` set in my general.php config file (just like in the [github example](https://github.com/selvinortiz/craft-plugin-patrol#configure)). It works 99% of the time.
  
  But it doesn't work right for 404s.
  
  Normally, when I go to a page, it automatically changes from <http://mysite.com/mypage> to <https://www.mysite.com/mypage>
  
  But when I got to a broken page, <http://mysite.com/brokenpageurl>, it doesn't redirect.
  
  My 404.twig template lives in the root of the templates directory. So if I go to mysite.com/404, it automatically redirects to <https://www.mysite.com/404> - because it's a real page.
  
  But when another page exits to a 404, it doesn't redirect.
  
  I'm wondering if the 'exit to 404' rendering bit happens before patrol gets a chance to do its redirect.
  
  On Craft 3.3.19 and Patrol 3.1.3. But I can reproduce the issue on a couple of different sites.
  
  Edit: I made [a ticket on github](https://github.com/selvinortiz/craft-plugin-patrol/issues/21) too.
  
  **Tags:** craft3
  
  > **Comments:**
  > **username_1**: I was going to suggest creating an issue on their repo, but it looks like you beat me to it. :) https://github.com/selvinortiz/craft-plugin-patrol/issues/21  
  > **username_2**: I'd suggest enforcing things like SSL/non-SSL and www./non-www. in your webserver's config rather then via a plugin. [Apache rewrite http to https](https://cwiki.apache.org/confluence/display/httpd/RewriteHTTPToHTTPS) -- [Nginx rewrite http to https](https://bjornjohansen.no/redirect-to-https-with-nginx)  
  > **username_0**: Seeing no bites here or on my github issue, I put rewrite rules into my .htaccess file.  
  
  ---
  
  ## 0 answers
  
  