Problem/Motivation
I'm attempting to use CDN to produce URLs for static assets that will change when those static assets change.
My site is also using the Redirect module, with its canonical URL redirection enabled, so that requests for node/123
get redirected to content/title
etc.
I also have languages enabled on the site. So that in fact, if someone requested //fqdn/node/123
it'll actually get redirected to: //fqdn/en/content/title
.
When enabling the CDN module, with farfuture, all of the files served no longer work since they are for paths like:
//fqdn/cdn/farfuture/3d8UFbZKlGF89ZdOA-ZpIxKK8s7YZImp7zXZXcBMiDs/1479386946/themes/custom/theme_name/favicon.ico
which redirect module will intercept and redirect to:
//fqdn/en/cdn/farfuture/3d8UFbZKlGF89ZdOA-ZpIxKK8s7YZImp7zXZXcBMiDs/1479386946/themes/custom/theme_name/favicon.ico
and then the security token is invalid.
Proposed resolution
I'm not sure! I feel like either:
- the CDN paths needs declaring in such a way that it won't get tweaked for language prefixes etc.
- the URL that CDN module outputs should run through that system and be altered accordingly
- that the route should be flagged in such a way that redirect module won't touch it
- The security token should be valid if the bit that was actually hashed matches, essentially ignoring prefixes.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#3 | 2924916-3.patch | 696 bytes | Wim Leers |
Comments
Comment #2
Steven Jones CreditAttribution: Steven Jones at ComputerMinds commentedTo skip the redirect normalizing, we could
_disable_route_normalizer
as described byRouteNormalizerRequestSubscriber
.http://cgit.drupalcode.org/redirect/tree/src/EventSubscriber/RouteNormal...
It looks like this route normalized might end up in core in #2641118: Route normalizer: Global Redirect in core
Comment #3
Wim LeersThat's exactly what the
feature is for, so yay! 🎉If we'd do that, then the Redirect module would still end up redirecting, which would be a performance regression.
This I strongly agree with: we should be able to flag routes as being language-agnostic. But, there's no mechanism for this (AFAICT).
So this is then the best (and only) solution. You also gave super helpful pointers in #2, thanks! 👏
Since
\Drupal\redirect\Routing\RouteSubscriber
does exactly the same for the routes generating image style URLs, I think adding the_disable_route_normalizer
route option is indeed the right thing to do. #2877055: Disable route normalizer on remote image style routes to avoid problems with redirect module is doing the same for another contrib module.Patch attached for this!
Finally, a nitpick: this cannot be a bug, since it's integration with a contrib module. Only after #2641118: Route normalizer: Global Redirect in core lands, this could possibly qualify as a bug.
Comment #4
Steven Jones CreditAttribution: Steven Jones at ComputerMinds commentedLovely! Didn't know that the route defaults would end up as request attributes, that's cool!
Works for me :)
Comment #5
Wim LeersDid you manually test it, and confirm that it solves the problem? :)
Comment #6
Wim LeersComment #7
Steven Jones CreditAttribution: Steven Jones at ComputerMinds commentedSorry yeah, I got my site setup with all the right code, but no patch, tested, and it was broken as per the issue summary.
Applied the patch, rebuilt the container (and router) and then the issue was fixed!
Comment #8
Wim Leers👌
Credited you!
Comment #9
Wim LeersThank you!