Skip to content

Getting querystring params to load when apache's ErrorDocument 404 is triggered #1140

@adrianbj

Description

@adrianbj

Short description of the issue

There may not be too many scenarios where this is important, but if you visit a URL which is blocked by this rule (https://github.com/processwire/processwire/blob/51629cdd5f381d3881133baf83e1bd2d9306f867/htaccess.txt#L367), apache redirects directly to index.php without any querystring parameters due to this rule (https://github.com/processwire/processwire/blob/51629cdd5f381d3881133baf83e1bd2d9306f867/htaccess.txt#L73)

The problem with Tracy is that it loads its js file via querystring params, eg:
http://pwtest.test/bla'h/?_tracy_bar=js&v=2.7.3&XDEBUG_SESSION_STOP=1

Note the apostrophe inside bla'h - this means that when apache redirects to index.php the querystring params are removed and Tracy doesn't load.

Optional: Suggestion for a possible fix

I wonder if it might be possible to make use of $_SERVER['REDIRECT_QUERY_STRING'] to add those back in so that Tracy can load?

Steps to reproduce the issue

  1. Make sure Tracy is running
  2. Load a page on the site with a character which isn't allowed by the htaccess regex restrictions, eg an apostrophe
  3. Note that the Tracy bar doesn't load and you get these errors:

78830978-b7480c00-799d-11ea-8dd4-67e51e6926e4

http://pwtest.test/blah (no apostrophe)

image

image

http://pwtest.test/bla'h (with apostrophe)

image

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions