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

Apache rewrite config - double-encoding query strings #150

Open
jesusbagpuss opened this issue Jun 9, 2021 · 0 comments
Open

Apache rewrite config - double-encoding query strings #150

jesusbagpuss opened this issue Jun 9, 2021 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed S1 Severity: 1

Comments

@jesusbagpuss
Copy link

Having deployed the suggested configuration from: https://ssl-config.mozilla.org/#server=apache&version=2.4.6&config=intermediate&openssl=1.0.2k-fips&ocsp=false&guideline=5.6 to a server, I experience double-encoded query-string issue.

<VirtualHost *:80>
    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^/\.well\-known/acme\-challenge/
    RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
</VirtualHost>

This results in a URL such as:
http://example.com/cgi/home?screen=EPrint%3A%3AView&id=1234
being rewritten as:
https://example.com/cgi/home?screen=EPrint%253A%253AView&id=1234

Using the 'NE (No Escape)' flag on the rewrite rule resolves this issue for my set-up at least:
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,NE,L]

It may not be as simple as this though - there have been changes in the way Apache/mod_rewrite handled the rewrites over time, and the 'NE' flag might break other aspects of the URL in older Apache versions (<2.4.1?):

@janbrasna janbrasna added bug Something isn't working help wanted Extra attention is needed S1 Severity: 1 labels Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed S1 Severity: 1
Projects
None yet
Development

No branches or pull requests

2 participants