8000 Subdomain routing improvement · Issue #11689 · cakephp/cakephp · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Subdomain routing improvement #11689
Closed
Closed
@LorenzoRogai

Description

@LorenzoRogai

This is a (multiple allowed):

  • bug

  • enhancement

  • feature-discussion (RFC)

  • CakePHP Version: 3.5.11

What you did

Tried to handle three different domains under the same application frontend/backend/api and configured the routes

What happened

In the documentation it says that this can be done by using the _host or ->setHost
I had many repeated $routes->connect()->setHost() , one for every route

What you expected to happen

It would be better to suggest setting this parameter globally on the scopes, so there will be one scope for every domain. It would be more clean

Edit: it doesn't work as it always pick the first / scope, it should pick the one associated to the host

Example

<?php

Router::scope('/', [ '_host' => 'subdomain1.domain.com' ], function (RouteBuilder $routes) {
});

Router::scope('/', [ '_host' => 'subdomain2.domain.com' ], function (RouteBuilder $routes) {
});

Router::scope('/', [ '_host' => 'subdomain3.domain.com' ], function (RouteBuilder $routes) {
});

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0