samedi 21 mai 2016

Laravel - CNAME + Subdomain Routing

I have my routes set up as follows:

<?php

Route::group([
    'domain' => '{username}.u.'.env('APP_DOMAIN'),
], function () {
    Route::get('/', 'FrontendController@site');
});

Route::group([
    'domain' => env('APP_DOMAIN'),
], function () {
    // Regular site routes
});

Route::group([
    'domain' => '{domain}',
], function () {
    Route::get('/', 'FrontendController@domain');
});

What I'm trying to achieve is allowing users to have their own sites, e.g. hello.u.domain.com, and for those sites to also be served through a custom domain that is CNAME'd to their subdomain. Using the routing above, the wildcard subdomain works perfectly fine. However the custom domain routing is never hit; whenever a custom domain that is CNAME'd to the subdomain is visited, the regular site routes are used.

APP_DOMAIN is not the same as the custom domain, and I have $router->pattern('domain', '[a-z0-9.]+'); in my RouteServiceProvider.php to allow {domain} as a full domain name.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2417Urb
via IFTTT

Aucun commentaire:

Enregistrer un commentaire