Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query String Sort #7

Open
Genaker opened this issue Aug 24, 2023 · 1 comment
Open

Query String Sort #7

Genaker opened this issue Aug 24, 2023 · 1 comment

Comments

@Genaker
Copy link
Owner

Genaker commented Aug 24, 2023

Query String Sort increases cache-hit rates by first sorting query strings into a consistent order before checking the Rdis cache.

By default, magento cache treats resources as distinct if their URL query strings are in a different order. For instance, these resources are cached separately:

/48088296?title=0&byline=0&portrait=0&color=51a516
/48088296?byline=0&color=51a516&portrait=0&title=0
Query String Sort changes this behavior. If two query strings exist with the same name, the URL is sorted by the parameter value. For example:

/example/file?word=alpha&word=beta and /example/file?word=beta&word=alpha

would be sorted to:

/example/file?word=alpha&word=beta

So​​lution :

$dataArray = $_GET;
$dataArray = array_filter($dataArray, 'strlen');
ksort($dataArray);

@YehorShytikovWB
Copy link

URL normalisation

How URL normalization works
URL normalization modifies separators, encoded elements, and literal bytes in incoming URLs so that they conform to a consistent formatting standard.

For example, consider a firewall rule that blocks requests whose URLs match www.example.com/hello. The rule would not block a request containing an encoded element — www.example.com/%68ello. Normalizing incoming URLs on the Cloudflare global network helps simplify firewall rules expressions that use URLs.

The URL normalization performed according to RFC 3986 is as follows:

The following unreserved characters are percent decoded:
Alphabetical characters: a-z, A-Z (decoded from %41-%5A and %61-%7A)
Digit characters: 0-9 (decoded from %30-%39)
hyphen - (%2D), period . (%2E), underscore _ (%5F), and tilde ~ (%7E)
These reserved characters are not encoded or decoded: : / ? # [ ] @ ! $ & ' ( ) * + , ; =
Other characters, for example literal byte values, are percent encoded.
Percent encoded representations are converted to upper case.
URL paths are normalized according to the Remove Dot Segments protocol.
In addition to the rules defined in RFC 3986, Cloudflare can apply the following extra normalization techniques:

Normalize back slashes () into forward slashes (/).
Merge successive forward slashes (for example, // will be normalized to /).
The performed URL normalization varies according to the configured settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants