silverstripe / silverstripe-framework

Silverstripe Framework, the MVC framework that powers Silverstripe CMS
https://www.silverstripe.org
BSD 3-Clause "New" or "Revised" License
722 stars 821 forks source link

Run CanonicalURLMiddleware in dev / test. #11167

Closed wilr closed 7 months ago

wilr commented 7 months ago

Module version(s) affected

5.0.0

Description

Currently CanonicalURLMiddleware only runs in production, this leads to the classic example of 'It works on mine(tm)' but more dangerously 'It works on the test site (tm)'. Out of the box, we should have as close to production behaviour as possible.

How to reproduce

Various ways to reproduce. The issue that hit this client was a fetch call fetch('api/endpoint') on UAT this successfully returns the response of api/endpoint controller. In production the response is a 301 redirect to 'api/endpoint/'.

Possible Solution

The PR changes CanonicalURLMiddleware to run by default in all environments. Specific rules can still be modified via YAML configuration.

Additional Context

No response

Validations

PRs

wilr commented 7 months ago

https://github.com/silverstripe/silverstripe-framework/pull/11154

GuySartorelli commented 7 months ago

PRs have been merged