Repository navigation
Added
- Redirects can be set to Exact match, so a redirect from
/ano longer also applies to/a/b./a/and/a?b=cstill match, as the query string isn't part of it. It's available on the Redirects tab, and in imported and exported CSV and XML files. Files without it still import, as a redirect that isn't exact. An import or an automatic redirect for an old url that's already saved replaces the row, so it clears the setting unless it sets it too, as it does with the wildcard setting and the redirect type. - Each regex redirect can have its own redirect type. Rules saved earlier keep following
DefaultRedirectTypeuntil you edit them, which saves the type shown on the form. - Patterns on the Ignored tab, such as
/api/*or*.php, stop every url matching them from being logged as a suggestion, and remove the suggestions already logged for them. A pattern only stops suggestions, so a redirect or regex redirect that applies to a url keeps working. It's the same idea asIgnoreSuggestionsUrlRegexPattern, but editors can do it without a deploy.
Security
- Wildcard and regex redirects no longer let a request choose the host of the redirect. Before,
/content->/turned/content//evil.cominto a redirect to//evil.com, and the regex format/$1did the same, as did$1capturinghttps://evil.com. A format that names a host itself, such as//cdn.example.com/$1, is left alone, and a capture naming the host of the request stays as it is. A rule that relied on$1capturing another host from the request now redirects to a path on the site. - The CSV export now escapes values a spreadsheet would run as a formula, whichever way they got into the database. A value starting with
=,@,+,-, tab, carriage return or line feed is prefixed with'. A;followed by one of those characters inside a value is written as%3B, because spreadsheets using;as the list separator would otherwise start a new cell there. System.Security.Cryptography.Xmlis raised from 10.0.7 to 10.0.13 inGeta.NotFoundHandler.Optimizely.Commerce. A site on ASP.NET Core uses the copy in its .NET runtime instead of this package, so make sure the site runs on .NET 10.0.13 or later.
Changed
Check these when upgrading, as they change how existing rules and integrations behave:
- The database version goes from 2 to 3. At startup, the application adds
ExactMatchtoNotFoundHandler.RedirectsandRedirectTypetoNotFoundHandler.RegexRedirects, so its database user needs permission to alter those tables. If that fails, an error is logged and reading the redirects then fails at startup. IRegexRedirectsServicehas new overloads ofCreateandUpdatetaking aRedirectType?, so a class implementing it needs them too. The existingUpdatekeeps the type of the rule.RegexRedirectFactory.CreateandCreateNewand theRegexRedirectconstructor take an optionalRedirectType?, so code calling them needs recompiling, and code overriding the factory needs updating.- The CSV export has a new
ExactMatchcolumn. - A redirect that would only append to itself now stops. With
/a->/a/b,/a/xstill redirects to/a/b/x, but a request already under/a/bstays a 404. With/a->/a?x=1,/a?y=2still redirects to/a?y=2&x=1, and that URL stays a 404. Before, these grew on every hop until the browser gave up. - URLs under an entry in the Deleted list now return
410. Before,/gone/,/gone?a=1and/gone/childwere redirected, often to the home page. - A request with no matching redirect keeps the status the application gave it. Before, a response that hadn't started yet was forced to
404.RequestHandler.SetStatusCodeAndShow404is now only called for deleted URLs, so a subclass overriding it no longer runs for unmatched requests. HttpContextExtensions.SetStatusCodeno longer clears the response, so a custom page keeps its headers when its status changes to410.- An ignored url with a
*in it, which used to only ignore that literal url, is now a pattern./*,https://example.com/*and others with nothing but wildcards and slashes in the path aren't, as they would stop all suggestions. Neither is one with an encoded%2Ainstead of a*. ISuggestionRepositoryhas a newDeleteMatchingmethod, which does nothing unless a class implementing it adds it, so suggestions stay in the list when adding a pattern.IgnoredModeltakes anISuggestionService.- CSV export: an imported file that was exported with escaped values keeps the
'prefix and the%3Bas part of the value. - Automatic redirects are no longer created for urls with an extension in
IgnoredResourceExtensions, as requests for those urls aren't redirected. Rows created earlier stay until you delete them. Check this if you overrideRequestHandler.IsResourceFileto redirect such files, or have pages with a url like/docs/node.jswith no trailing slash and children below them, as those children used to be redirected through that row.RedirectBuildertakes anIOptions<NotFoundHandlerOptions>. - A regex rule anchored at a
/, such as^/en/(.*), now matches against the path and query. It used to never match, as rules see the whole url, so one that has been sitting unused starts redirecting. Check your rules for this before upgrading. All other rules still only see the whole url. X.PagedListis upgraded from 8.4.3 to 10.5.9, which movesToPagedListto theX.PagedList.Extensionsnamespace. Code of your own calling it needs that using.- The results of the Index content URLs and Register content move redirects jobs are now only a summary. Details of what failed are written to the log, and the jobs take an
ILoggerin their constructors. - Each instance now checks the database for redirect changes every 5 minutes, which adds one query per instance per check that hashes every row of the redirects table. Set
RedirectsRefreshIntervaltoTimeSpan.Zeroto turn it off. A loader implementingIRedirectLoadercan addGetChecksumto take part, and without it the check is skipped. - A chain of more than
MaxRedirectHopsredirects in a row (default 10) now ends in a 404 with a warning in the log, also when it has no loop. Before, a browser followed it up to its own limit, around 20. Raise the limit if you have longer chains, or set it to0to turn this off. RequestHandlertakes aRedirectLoopGuard. This matters only if you construct or inherit from it yourself.- A redirect that would only request the same url again now stays a 404 in more cases, such as
/a->/a#top,//example.com/aor an empty new url. Moving to another scheme on the same url still redirects. - A handler failing on
RedirectsEventsno longer stops the others, and the failure now reaches the caller as anAggregateException. OptimizelySyncEventstakes anILogger<OptimizelySyncEvents>, andRedirectsInitializertakes anIRedirectLoader. This matters only if you construct or inherit from them yourself.- The published
module.confignow always comes from the add-on's package. Before, a site that removed the package's file from its publish got the copy in the site's folder instead, so a build step that edits that copy no longer changes what's published.
Known issues
- The confirmations in the admin UI use the TempData cookie, so on a site requiring cookie consent they don't show until the editor has consented.
Fixed
- The Redirects tab keeps its sort order after deleting or editing a redirect, as it already did with the search and the page. Before, the list went back to the default order.
- Editing a regex redirect keeps its place in the order. Before, the edit form didn't send the order number, which moved the rule to the top, where it was tried first.
- The admin pages confirm that a redirect was saved, deleted or ignored. Before, the page just reloaded.
- Redirects that keep leading to more redirects now end in a 404 after
MaxRedirectHopsredirects in a row (default 10), with a warning in the log, and stay that way for up to 30 seconds. Before, two rules pointing into each other (/a->/b/cand/b->/a/d) or a regex rule matching its own result (^/(.*)$->/en/$1) went on until the browser gave up. Each server counts on its own, so behind a load balancer without session affinity, the browser's limit can still be reached first. Browsers follow remembered permanent redirects without asking the server, so permanent redirects sending a url back and forth still end in the browser's error, and permanent redirects that grow do so after a few visits. - Regex redirects are no longer recompiled on every unmatched request. The cache held a query that built them again each time it was read.
- Instances that miss an update no longer stay out of date until a restart. A check every 5 minutes picks up redirects and regex redirects that never reached an instance.
- Two reloads at the same time could leave an instance without a new redirect, when a slow load that read the table before the save finished last.
- A failed reload on the instance saving a redirect no longer stops the other instances from being told about it.
- Leaving out
UseOptimizelyNotFoundHandlerno longer silently turns off the sync between servers. The sync starts anyway and a warning is logged. - The CMS navigation shows again on the add-on's page in the CMS on CMS 13. The layout's
<platform-navigation />wasn't bound to its tag helper, so the browser got an empty element. - Automatic redirects no longer fail with
Sequence contains no elementsfor content with no URL history. - A content language with no primary URL no longer stops automatic redirects for the remaining languages.
- Whitespace around old and new URLs is now removed when a redirect is saved, so a trailing space or tab in a form or an imported file no longer silently breaks it. Redirects saved earlier aren't changed: save them again to clean them up.
- The module copy on build skips unchanged files, so a running site holding the file no longer fails the build.
- Deleting a redirect from the admin redirects list (
IRedirectsService.DeleteById) now raisesRedirectsEvents.RedirectsUpdated, like every other write onDefaultRedirectsService. Before, the deleted redirect kept applying until the application restarted or another redirect was saved, andOptimizelySyncEventsnever told the other instances. - Redirects and
410responses for deleted URLs now also work when the application starts writing the response body inside the pipeline. The handler now runs just before that response starts. Before, it only ran after the pipeline finished, when changing headers threw an exception. A response that hasn't started by then is still handled at that point, soUseStatusCodePages*registered before the handler only sees requests the handler didn't redirect. A redirect applied to a response the application is already writing still carries that body, because it can't be stopped at that point; browsers follow theLocationheader. - When a status code page is re-executed (
UseStatusCodePagesWithReExecute), redirect lookup and logging use the URL the client requested, not the error page's URL. - Wildcard redirects now join the new URL and the appended path with exactly one slash. Before, the slash was chosen from the request URL instead of the new URL, so
/content->/legacyturned/content/file/into/legacyfile/, and/content->/legacy/turned/content/fileinto/legacy//file. - A wildcard redirect to
/no longer sends an emptyLocationheader when there is nothing to append (/content->/with/content/content), which made browsers request the same URL again. CustomRedirectCollection.Findno longer throwsArgumentOutOfRangeExceptionwhen the request repeats the old URL after extra slashes (/content/with/content//content) or when/is the old URL and the request is/?param=value.- The guard against redirects building up now also applies when the old URL ends in a slash, so
/content/->/legacyturns/content/content/fileinto/legacy/file, the same as/content->/legacyalready did. - Setting
UseInternalSchedulerno longer crashes the application at startup withNo service for type 'Microsoft.Extensions.Logging.ILogger'. - The notification request of the CMS navigation no longer fails with a
400on the add-on's page in the CMS on CMS 13. The layout didn't tell the navigation how to send the antiforgery token. UseOptimizelyNotFoundHandlernow logs a warning whenUseInternalScheduleris on. It has always removed the suggestions cleanup job from that scheduler, as Optimizely sites use the [Geta NotFoundHandler] Suggestions cleanup job scheduled job, so turning on the flag silently did nothing.dotnet publishof a site no longer fails withNETSDK1152: Found multiple publish output files with the same relative pathformodule.configonce the site has been built, or when projects in the solution use different versions of the add-on. A workaround for this in the project file can be removed, but still works.- A clean
dotnet publishof a site getting the add-on throughGeta.NotFoundHandler.Optimizely.Commercenow includesmodule.config. Before, it was only published if the site had been built first.
What's Changed
- Raise RedirectsUpdated when a redirect is deleted by id by @agunn26 in #195
- Fix bug when new url is missing trailing slash by @AndersHGP in #138
- Fix open redirect and crashes in wildcard redirects by @frederikvig in #198
- Handle redirects when the response has started, and stop forcing 404 (continues #185) by @frederikvig in #199
- Refactor middleware and removal of forced http 404 by @Alexandre-P26 in #185
- Fix growing redirects, deleted URLs redirecting, CSV injection and the scheduler crash by @frederikvig in #200
- Fix the regex open redirect and query-string growth, and clarify release notes by @frederikvig in #201
- Show the CMS navigation on CMS 13, and fix automatic redirect and whitespace bugs by @frederikvig in #202
- Keep redirects in sync when an update doesn't reach an instance by @frederikvig in #203
- Fix regex rules on a path, regex recompiling, job results and X.PagedList by @frederikvig in #204
- Confirm saves in the admin UI, and skip redirects for ignored resources by @frederikvig in #205
- Fix the notification 400 in the CMS, and warn about UseInternalScheduler by @frederikvig in #209
- Add an exact match option, and a redirect type per regex rule by @frederikvig in #210
- Stop redirects that keep leading to more redirects by @frederikvig in #211
- Add wildcard patterns to the ignored suggestions by @frederikvig in #214
- Publish module.config once, also through the Commerce package by @frederikvig in #213
- Raise System.Security.Cryptography.Xml to 10.0.13 by @frederikvig in #215
- Keep the sort order after deleting or editing a redirect by @frederikvig in #216
- Prepare the 8.0.0 release notes and fix the install docs by @frederikvig in #217
New Contributors
- @frederikvig made their first contribution in #198
- @Alexandre-P26 made their first contribution in #185
Full Changelog: v7.1.0...v8.0.0