I have limited experience with D8 and custom routes.
Current mobile video system for client takes a scheme-less url for the video like so
https://example.com/mobile-video/some-video-desktop.azureedge.net
The routing has worked fine until we had a vendor change for video hosting and the new URLs include slashes and query strings which may or may not be the issue.
mobilevideo.routing.yml looks like
mobilevideo.content:
path: '/mobile-video/{vguid}'
defaults:
_controller: 'Drupal\mobilevideo\Controller\MobileVideoController::content'
_title: 'Mobile Video'
requirements:
_permission: 'access content'
vguid: '^[-a-zA-Z0-9.\/?=]+'
Prior to today the validation was just '^[-a-zA-Z0-9.]+'
So testing the new URLs I am getting 404s. But if the parameter passed to the mobilevideo.routing.yml fails validation a 404 is the correct response so I assume the issue is validation. https://www.drupal.org/docs/8/api/routing-system/parameters-values-validation-in-routes
So I changed the validation from vguid: '^[-a-zA-Z0-9.]+'
to vguid: '^[-a-zA-Z0-9.\/?=]+'
that had no effect and I also tried '.+'
and also the original without ? and = with no change.
I should note that the original URLs with no slashes worked continously through all of this and that each change was followed by clearing all caches.
Also tried removing validation entirely and that also failed so I am wondering if my path cannot include slashes in the parameter for reasons beyond validation?
What should my next step be in debugging this?
A full example URL will look like
UPDATE Based on info re optional parameters and the comments on this post I added four more parameters and default values of '' for each updating mobilevideo.routing.yml to
mobilevideo.content:
path: '/mobile-video/{vguid}/{vguidtwo}/{vguidhtree}/{vguidfour}/{vguidfive}'
defaults:
_controller: 'Drupal\mobilevideo\Controller\MobileVideoController::content'
_title: 'Mobile Video'
vguid: ''
vguidtwo: ''
vguidthree: ''
vguidfour: ''
vguidfive: ''
requirements:
_permission: 'access content'
vguid: '^[-a-zA-Z0-9.]+'
vguidtwo: '^[-a-zA-Z0-9.]+'
vguidthree: '^[-a-zA-Z0-9.]+'
vguidfour: '^[-a-zA-Z0-9.]+'
vguidfive: '^[-a-zA-Z0-9.]+'
Then updated the controller to use public function content($vguid, $vguidtwo, $vguidthree, $vguidfour, $vguidfive) {
and assemble the URL based on that array.
Attempting to flush the cache gets The website encountered an unexpected error. Please try again later.
. What did I miss?