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 update causes Drupal URLs with spaces and other special characters to fail #77

Open
neilt1700 opened this issue Apr 13, 2023 · 4 comments

Comments

@neilt1700
Copy link

A recent update to Apache (2.4.52) will cause URLs with spaces and other special characters to fail. For example:
Go to https://example.com/search
Search for "this and that"
This will take you to: https://example.com/search/node/this and that
and a 403 Forbidden message

Adding a "B" flag to rewrite rules in the .htaccess file in the top directory of Drupal 6 fixes this:
From:
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
To:
RewriteRule ^(.*)$ index.php?q=$1 [B,L,QSA]

See: https://stackoverflow.com/questions/75684314/ah10411-error-managing-spaces-and-20-in-apache-mod-rewrite

neilt1700 pushed a commit to Commtap-Drupal6/drupal that referenced this issue May 5, 2023
- See d6lts#77 "Apache update
  causes Drupal URLs with spaces and other special characters to
  fail"
@amorsent
Copy link
Contributor

Cross referencing my pull request for this issue.
#79

@JPustkuchen
Copy link

Just ran into this, but can't confirm adding the B solves this entirely.

A big issue with this are "?destination=XXX?Y" URLs.
The parameters from the destination URLs are also escaped and lead to broken 403 URLs.

Logs still say:

AH: Unsafe URL with %3f URL rewritten without UnsafeAllow3F, referer: https://www.example.com/test123?ref_nid=366472

I wasn't able to find a fully working workaround yet.
For plesk users this is also documented here: https://support.plesk.com/hc/en-us/articles/13302819141783-Domain-in-Plesk-shows-error-403-rewritten-query-string-contains-control-characters-or-spaces
But switching to FastCGI also didn't solve it for me.

@JPustkuchen
Copy link

Update: #79 seems to be the only real solution. Thank you @amorsent! Maybe someone should ping @dsnopek?

@JPustkuchen
Copy link

Update 2: As a super hacky and risky emergency fix you may use: RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,B,UnsafeAllow3F]
But please note you're putting your project on security risk!

Just saw the Typo3 community is hardly hit by this Apache fix.

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

3 participants