I have a site configured with 2 languages (Portuguese, Brazil and Spanish) and domain as language selector.

If I leave blank the 404 page, it doesn't work correctly, system throw me this error:

El sitio web encontró un error inesperado. Vuelva a intentarlo más tarde. (Unexpected error.)

Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /http://public.local.site.com/system/404" in Symfony\Component\HttpKernel\EventListener\RouterListener->onKernelRequest() (line 159 of vendor/symfony/http-kernel/EventListener/RouterListener.php).

However, if I configure any corect path as 404 path, system run correctly.

If I disable language detection by domain, system run correctly too.

I attach 2 images with the configuration screenshot.

[I'm not sure if it's a system bug or a language bug or any others]

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

estoyausente created an issue. See original summary.

laxman.ghavte’s picture

Assigned: Unassigned » laxman.ghavte
gapple’s picture

Title: 404 default pages not working with domain configured as language selector » Error on default 404 & 403 pages with domain-based language selection
Version: 8.0.2 » 8.0.x-dev
Priority: Normal » Major
Status: Active » Needs review
FileSize
928 bytes

The problem occurs in DefaultExceptionHtmlSubscriber::makeSubrequest(), due to the value passed in via Url::fromRoute('system.404')->toString(). With domain-based language negotiation the url is prefixed with the protocol + domain, which messes up this check:

    if (!($url && $url[0] == '/')) {
      $url = $request->getBasePath() . '/' . $url;
    }

and results in a forward slash being prefixed to the absolute url.

gapple’s picture

Component: system.module » language system
Assigned: laxman.ghavte » Unassigned
Issue tags: +D8MI, +language-base, +multilingual
Leksat’s picture

Status: Needs review » Reviewed & tested by the community

I just met this bug. #3 fixes it! And the code looks good.

estoyausente’s picture

For me it's ok too. Code run nice and bug seems solved.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

Looks like this should have an automated test to ensure we don't break this in the future.

gapple’s picture

Status: Needs work » Needs review
FileSize
7.38 KB

I used CustomPageExceptionHtmlSubscriberTest as a reference, and added a test for when the url_generator service returns an absolute URL.

gapple’s picture

Issue tags: -Needs tests

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Leksat’s picture

The buggy code was removed in #2595695: 4xx handling using subrequests: no longer able to vary by URL
Probably this issue can be closed now.

gapple’s picture

Lets try just the test, to make sure it's resolved and doesn't break in the future...

Status: Needs review » Needs work

The last submitted patch, 12: drupal-2649698-12-domain-language-404-test.patch, failed testing.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

colorfulCoder’s picture

Version: 8.4.x-dev » 8.5.x-dev
Issue tags: +Vienna2017

Triaging this issue during Vienna 2017 with @Anna_Radulovski
Changing the version to 8.5.x-dev because all changes should be applied to 8.5.x and backported to 8.4.x. I got this advice from @realityloop.

anna.radulovski’s picture

Issue summary: View changes

We are working on this issue with @Emmezali.
There's no "brazilean" language, there's Brazilian Portuguese that can be chosen as Portuguese, Brazil.
We updated the issue summary accordingly.

colorfulCoder’s picture

Retesting the patch on version 8.5.0 failed (as can be seen in comment #12.

This needs to be fixed before we can close this issue.

TO DO: fix patch so it runs without errors.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

pameeela’s picture

Status: Needs work » Closed (duplicate)
Issue tags: +Bug Smash Initiative

It's been confirmed this was fixed in #2595695: 4xx handling using subrequests: no longer able to vary by URL which also includes tests, so I'm closing this as a duplicate.