• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question Reverse Proxy - ignore subfolder

chubba

New Pleskian
Hi,

I have a site that has been previously hosted via apache only and we use a script to generate dynamic pages. A request hits a subfolder with a script that looks for 404 errors and if the request URI is in a list then a dynamic page is served. This is a massively cut-down version of the script but it goes something like this:

PHP:
if (preg_match("/\/shop-search\/(.*)-shoes$/", $_SERVER['REQUEST_URI'], $matches)) {
    header("HTTP/1.1 200 OK");
    $colorName = trim(strip_tags($matches[1]));
    $pagenum = 1;
    $mainURL = "/shop-search/" . $colourName . "-shoes/";
    $color = array(
        "Blue" => "Blue",
        "Red" => "Red",
    );
    if (isset($color[$colorName])) {
        $keywords = $color[$colorName];
        $pageType = "colour";
        require_once "by-color.php";
        exit;
    }
}

Under Apache, it catches the 404, does the checks and then renders the page with a 200 message, the browser is not served a 404. With the nginx reverse proxy the page still renders but a 404 is passed to the browser so this means the pages are erroring for Googlebot and the pages have dropped out of the index. Is there any way to stop nginx processing that folder at all or any other way to stop the 404 being pushed back to nginx before the 200 code is served?

TIA

chubba
 
Back
Top