When clicking on Edit button on main content page (adminpath/content) the following (example) link is generated:
http://www.site.com/node/999/edit?destination=/adminpath/content
However, the following error is generated when accessing above url:
The website encountered an unexpected error. Please try again later.
The following log entry is generated:
Location: http://www.site.com/node/999/edit?destination=%2Fadminpath%2Fcontent
Referrer: http://www.site.com/adminpath/content
Message: UnexpectedValueException: Invalid Host "www.site.com?destination=" in Symfony\Component\HttpFoundation\Request->getHost() (line 1238 of C:\inetpub\wwwroot\sites\site.com\vendor\symfony\http-foundation\Request.php).
Site is running under Windows Server (IIS)
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | 2821674-19-not-working-with-drupal-8.2.x-and-query-destination.patch | 970 bytes | HalfChem |
Comments
Comment #2
kapetan commentedComment #3
pleppik commentedWe are seeing similar behavior for a variety of admin pages, not just Edit Content.
Site is running under Linux.
Comment #4
raphael apard commentedI cannot reproduce this error.
You are using multisite ?
Could you try with the new release (8.x-1.1) ?
Comment #5
pleppik commentedWe are using the current version (8.x-1.1) and Drupal Core 8.2, in a single site installation.
Steps to reproduce (on our installation):
1) login as an admin user
2) go to any node, and click the "Edit" from the node's pop-up admin menu
This will give the error and log entry described in the report. Disabling the Rename Admin Paths module makes the error go away.
Comment #6
pleppik commentedComment #7
raphael apard commentedDo you set "trusted_host_patterns" in your settings.php ?
I try with "trusted_host_patterns" enabled but i'm cannot reproduce
Comment #8
pleppik commentedWe normally have trusted_host_patterns set, and encountered the error. We tried turning it off, but that did not correct the error.
Comment #9
pleppik commentedAlso, the error only happens when there's something that looks like a path passed as a parameter in the URL.
So this fails: /node/944/edit?destination=/etc/content (/etc/ is our renamed admin path)
This also fails:/node/944/edit?destination=/ (note no admin path anywhere in the URL)
But this succeeds: /node/944/edit
This also succeeds: /node/944/edit?arglebargle
But this fails: /node/944/edit?arglebargle=/etc/content
Comment #10
kapetan commentedSame thing here, this happens only if '/' is included somewhere in the path. We also have trusted_host_patterns set. I'm almost sure the whole setup worked before updating to Drupal 8.2. We are also using custom bootstrap theme if this is important at all (it may be bootstrap specific)....
Comment #11
aprogs commentedThe bug was not reproduced with Drupal 8.2.1 and Rename Admin Paths 8.x-1.1.
Next steps were made to reproduce the bug:
?destinationparameter in the URL.In the result user gets redirected without the error. Please let me know if you need more input about test environment.
Comment #12
kapetan commentedThe problem happens between step 3 and step 4, node edit page is not displayed at all, instead "The website encountered an unexpected error. Please try again later." error is displayed.
It's still there, tested with 8.2.3 and Rename Admin Paths 8.x-1.1.
Comment #13
pleppik commentedOn the theory that this might be some sort of interaction between modules, here's a list of the non-core modules we have installed and active on our site:
Comment #14
kapetan commentedOk, here are the modules we also have and match your list:
Chaos Tools
Composer Manager
Pathauto
Redirect
Token
Metatag
Honeypot
Google Analytics
YAMLform (WebForm now)
Currently, Druapl 8.2.4 with all latest updates for above modules and the problem is still here. Not sure, could be a conflict with Pathauto or Redirect....
All of the modules were here from the start but seems like update of some of above modules created conflict with rename admin paths since this problem was not present few months ago.
Comment #15
rooby commentedI am also seeing this error.
Currently I am running
* Drupal 8.2.1
* Rename admin paths 8.x-1.1
I see the problem on Apache/2.4.16 (Ubuntu), however I also have the site running on an IIS8 Azure instance and I don't have the problem there so it would seem to be server configuration related, which would explain why some people don't see it.
Comment #16
kapetan commentedI went back to this issue today and after some time of analyzing the code and testing I think I found the solution for the problem, tested on two different IIS servers running Drupal 8.2.4 sites.
Here is original processInbound function:
public function processInbound($path, Request $request) {
$config = \Drupal::config('rename_admin_paths.settings');
// Admin path
if ($config->get('admin_path')) {
$admin_path_value = $config->get('admin_path_value');
// 404 for default admin path
if (preg_match('|^/admin(?![^/])|i', $path)) {
$path = NULL;
}
// Get back default admin path
elseif (preg_match('|^/' . urlencode($admin_path_value) . '(?![^/])(.*)|', $path, $matches)) {
$path = '/admin' . $matches[1];
}
}
// User path
if ($config->get('user_path')) {
$user_path_value = $config->get('user_path_value');
// 404 for default user path
if (preg_match('|^/user(?![^/])|i', $path)) {
$path = NULL;
}
// Get back default user path
elseif (preg_match('|^/' . urlencode($user_path_value) . '(?![^/])(.*)|', $path, $matches)) {
$path = '/user' . $matches[1];
}
}
return $path;
}
----
$path = NULL; line seems to be the source of the problem.
Changing this line to:
$path = '/';
resolves the problem, at least here... Hope this helps others with same issue.
Comment #17
raphael apard commentedThank for analyzing this issue.
Changing $path from NULL to "/" will remove the 404 on original path "/user" for example and this original url will serve the frontpage instead of a 404.
Comment #18
kapetan commentedSeems like NULL is problematic for the server so you can put $path = '/404'; and it will still work. I actually used this path during testing.
Comment #19
HalfChem commentedI rolled a quick patch for the changes mentioned #18 . Thanks for all the hard work on this module!
Comment #21
raphael apard commentedThanks