As soon as, I set domain records with country paths, I get 404 errors on all pages, followed by a routing symfony error:

Symfony\Component\Routing\Exception\ResourceNotFoundException: None of the routers in the chain matched url '/system/404' in Symfony\Cmf\Component\Routing\ChainRouter->doMatch() (line 207 of C:\laragon\www\d8.dev\vendor\symfony-cmf\routing\ChainRouter.php).

I have to uninstall the module to make my website work again.
To be able to reinstall the module again and not having those 404 page with routing error, I have to remove first all domain records.

Comments

heyyo created an issue. See original summary.

heyyo’s picture

Is this module working only with Apache ? Or could it be used also with NGINX ?

heyyo’s picture

Issue summary: View changes
agoja’s picture

Hello,

I faced the same problem.
Looks like there is no validation for available $domain_suffix in CountryPathProcessor
We need to process path only in case when $domain_suffix was set in configuration.

itsekhmistro’s picture

Reviewed patch in #4 is ok
but reproduced the issue for website frontpage - 404 Not found is displayed in case of request to http://example.com/usa
It's related to fact that $path should be "/" in case of request to frontpage.

Added a fix for that.

itsekhmistro’s picture

>Is this module working only with Apache ? Or could it be used also with NGINX ?

Yes, it's working for both Apache and NGINX. Initially developed on Nginx.
There is no known dependency on a webserver platform.

itsekhmistro’s picture

StatusFileSize
new1.17 KB
itsekhmistro’s picture

Status: Active » Fixed

The last attached patch is applied.

heyyo’s picture

Thanks for your work, but I still have the same issue with the last version of country_path.

Myabe I'm not using the module properly.

Here is some more details:

I have only 2 domains:
- d8.dev (with machine name d8_dev)
- d8.dev/france (with machine name d8_dev_fr)

I have defined my 2 different frontpages by importing 2 domain_config with these exact settings:

domain.config.d8_dev.system.site
name: 'Drupal 8 global'
page:
front: /node/2
langcode: en
default_langcode: en

domain.config.d8_dev_fr.system.site
name: 'Drupal 8 France'
page:
front: /node/1
langcode: fr
default_langcode: fr

When browsing

http://d8.dev : I successfully see my node/2

When browsing :

I receive error 404.

I inserted in my page the block Domain server information.
For any url under http://d8.dev/france, this block shows domain d8_dev, never d8_dev_fr.

By replacing this code

function country_path_domain_request_alter(Drupal\domain\DomainInterface &$domain) {
  $path_prefix = $path_info[1];

by

function country_path_domain_request_alter(Drupal\domain\DomainInterface &$domain) {
  $path_prefix = '/' . $path_info[1];

The block Domain server information shows now d8_dev_fr, but I still get the error 404 on any page under http://d8.dev/france

I hope those details, will help. regards

heyyo’s picture

Status: Fixed » Needs work
nijinanijil’s picture

I am facing the same issue #10

nijinanijil’s picture

Hi,

I have set the domain records in the below mentioned way and it is working for me.

Host name : localhost
Domain Name : Domain 1
Country Path : usa (without '/')

Host name : localhost
Domain Name : Domain 2
Country Path : cn (without '/')

Thanks
Nijil

heyyo’s picture

Thanks for the update @nijinanijil
It's working too for me :-)
As the description of the country_path property should be fixed.

heyyo’s picture

Now I can see my frontpage specified in my french domain config.
But there is still a problem with all URLS on the page. None of them start with the country path france.
Do you have the same issue ?

nijinanijil’s picture

@heyyo

I am able to get URLs with country path for the links coming other than from editor. For the editor links I am not getting country path appended.

agoja’s picture

Hello,

Is it still relevant ?

Can't reproduce with latest module version.

Regards.

agoja’s picture

Status: Needs work » Active
itsekhmistro’s picture

Status: Active » Closed (cannot reproduce)