Tagged: , , ,

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1159870

    update: this may have been a server config issue. nginx does not seem to process (missing) static files (on WPEngine at least) through the WP 404 page, so extra rules need adding to point to the custom 404 page

    in trying to fix the nginx 404 showing for 4.6 the WPEngine team had added proxy_intercept_errors = on; however this is not required

    these lines however are apparently required on WPEngine in the nginx config
    error_page 404 =404 /404-2/; // (URL of 404 page on our site is /404-2)
    error_page 403 =403 /404-2/;

    There seems to be an issue with the 404 implementation in Enfold 4.6.3.1 compared to 4.4.1

    In order to register 404s for file types (eg .pdf, .txt etc) we need to add an entry into WPEngine’s nginx config
    error_page 404 =404 /404-2/;

    (my 404 page url is /404-2)

    this works with Enfold 4.4.1’s 404 custom page settings.

    When I go to example.com/this-is-not-a-page, I get my custom 404 page
    When I go to example.com/this-is-not-a-file.pdf, I get my custom 404 page

    however in Enfold 4.6.3.1 have to disable the custom 404 Enfold setting, otherwise I just get an nginx 404 error instead of my custom wordpress page.

    Both versions should behave the same

    Also in Enfold 4.6.x a bad login at /wp-login.php also leads me to an nginx 404 page rather than back to the login page with a validation error.
    In Enfold 4.4.x it leads me to my custom 404 page

    both should presumably take me back to /wp-login.php and show me an error

    #1160815

    Hey codemonkeynorth,

    Unfortunately not a lot we can do to help with this as it is a configuration issue and our knowledge is a little bit limited.

    Best regards,
    Basilis

    #1160817

    Hi,

    yes sorry I think in this case you are right. It was a coincidence that 4.4 and 4.6 were (not) working differently in that the nginx configs on the servers were also different.

    I read you’d changed the 404 handling in 4.6 from another issue thread, which is why I thought there was an issue at the Enfold end.

    note to anyone coming to this thread though: we had to set an nginx rule for static files pointing to our custom 404 (eg mysite.com/this-doesnt-exist.pdf), and then let WP/Enfold custom 404 setting deal with dynamic pages

    thanks
    J

    #1161400

    Hi,
    Thank you for sharing all those details, we do appreciate that a lot.

    Best regards,
    Basilis

    #1161434

    For anyone interested here’s the full rule in place on nginx that covers http->https and static file custom 404’s (note our 404 page slug is 404-2)

    WPEngine
    tech staff created it but if anyone has any better suggestions please let me know

    
    set $if_https 0;
    if ( $http_x_forwarded_proto != "https" ) {
      set $if_https 1;
    }
    set $if_content_includes 0;
    if ( $uri ~* "/wp-content|wp-includes|\.*" ) {
      set $if_content_includes 1;
    }
    set $force_assets "$if_https:$if_content_includes";
    if ( $force_assets = "1:1" ) {
       rewrite ^/ https://$host$uri? permanent;
    }
    
    error_page 404 =404 /404-2/;
    error_page 403 =403 /404-2/;
    
    #1161739

    Hi,

    Thanks for sharing your solution and for the update. I’ll go ahead and close this thread for now then, please open a new thread if you should have any further questions or problems.

    Best regards,
    Rikard

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.