Turning on Cloudflare SSL Giving Nginx 404 Errors

  • Hi good evening,


    So I went over google and clicked a link back to my website which is teenhut.net. I got this Google Chrome Unsecured site error. That made me try getting an SSL. So I signed up for Cloudflare and tried it's free SSL. So when I enable SSL and forced redirect to HTTPS, it works fine for my homepage but not for the internal pages. All Internal Pages, board page or thread pages throw up Nginx 404 Error. I then turned off from ACP the enable url rewrite feature that rewrites .index.php?Thread name to /thread/thread name and the site was working fine.


    So it seems there is some url re write issue that needs fixing to make it work. When I turn off SSL or say http to https redirect force from cloudflare, my site becomes unsecured but all links are working.


    Let me share my nginx conf:



    I would have assumed some issue related to cloudflare but when I turn off the Enable URL rewrite from ACP, the site works fine. So somewhere the rewrite and HTTPS is not going well together and with some editing of Nginx Conf, it should get fixed.


    Please advice how to fix it. I really would like to get SSL or else many of my visitors are running away with the unsecure message they are getting.


    Thanks,

    Mayank

  • I have added the new code in the link you sent, but that code does the same it was doing before. It rewrites older index.php? urls to friendly URLs.


    My problem is when I turn on HTTPS redirect, those friendly URLs turn a 404 error for all my Board and Thread pages.

  • Okay let me share more details:


    See this is a page of one of the boards "Cafe". It works fine at the moment.



    Always Use HTTPS


    Redirect all requests with scheme “http” to “https”. This applies to all http requests to the zone.



    Now let me turn on this:

    Quote

    Always Use HTTPS

    Redirect all requests with scheme “http” to “https”. This applies to all http requests to the zone.

    Quote

    Automatic HTTPS Rewrites

    Automatic HTTPS Rewrites helps fix mixed content by changing “http” to “https” for all resources or links on your web site that can be served with HTTPS.


    SSL from Cloudflare has been set up.


    Now lets refresh the same page:



    As you can see above, it does not work. Now we will see if homepage works:



    As you can see, it works fine.


    Now let us "untick" the below function from Options >> General tab under ACP.


    Quote

    Enable url-rewrite


    Now let us go back to the same page that threw 404 error.



    It works?


    That means when HTTP is getting re directed to HTTPS, the url rewrite function is causing some glitch. I turned off Cloudflare redirect function and added my own http to https redirect code in Nginx Conf file, but the problem was the same.

  • I didn’t seen it before: Your nginx configuration above seems not to apply to HTTPS connections since there is no HTTPS configured properly.

    Plugins, Designs, Hosting, Support und mehr: KittMedia

  • I wasn't sure if anyone had a clue to fix it, so I decided not to wait around and attempt a new solution. I moved to a new server where I installed Plesk that uses Apache + Nginx together. Previously I was only with Nginx 100%. Now I am using a new combination of Web Server, Apache+Nginx and using .htaccess rewrite rules as per above link posted by Black Rider. Works fine now. Thanks.