Closed hognevevle closed 7 years ago
Can you confirm there is no caching of redirections going on?
The default settings (i.e. no changes at all in App_Start) should result in a .css request NOT being redirected. I've just confirmed that at this end:
i18n.UrlLocalizer.QuickUrlExclusionFilter = new System.Text.RegularExpressions.Regex(@"(^\/dummy\/)", RegexOptions.IgnoreCase);
then redirect happens.Failing all that, you might build against the source and put a breakpoint in i18n.EarlyUrlLocalizer.ProcessIncoming to see what's happening.
Good way to ensure against caching is to add arbitrary query string to the URL, of course.
Seems like IIS was doing some caching of its own, indeed. After restarting IIS, the exclusions were working just fine. I only thought about client caching, and thought I was escaping it all by going the curl route :)
Thanks a lot for your input!
Hi!
I've been trying for a while to successfully exclude certain URLs from being localized (and thus saving the redirection round trip), but I'm not having too much luck.
In my Application_Start(), I have added the following:
i18n.UrlLocalizer.QuickUrlExclusionFilter = new Regex(@"(?:\.css|\.json|\.less|\.jpg|\.jpeg|\.png|\.gif|\.ico|\.svg|\.woff|\.woff2|\.ttf|\.eot)$", RegexOptions.IgnoreCase);
However, this does not seem to exclude those files. I tested to fetch a .css file via curl to see what is happening:
As you can see, the redirection to /en-US/ is still happening.
I have also tried the following, which does not change the outcome:
i18n.LocalizedApplication.Current.UrlsToExcludeFromProcessing = new Regex(@"(\.css)$");
I've done some additional tests using i18n.UrlLocalizer.IncomingUrlFilters, but not having any success there either.
i18n.UrlLocalizer.IncomingUrlFilters += delegate (Uri url) { throw new Exception(url.LocalPath); };
When retrying my request above, the exception reveals: System.Exception: /Content/ So what happened to the rest of the URL (bootstrap/css/bootstrap.min.css)?
Other properties I've defined in App_Start() are:
i18n.UrlLocalizer.UrlLocalizationScheme = i18n.UrlLocalizationScheme.Scheme1; i18n.LocalizedApplication.Current.DefaultLanguage = "en-US";
What am I missing?
Any input would be greatly appreciated.