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
[X] Check that there isn't already an issue that reports the same bug
[X] Double check that your reproduction steps work in a fresh installation of silverstripe/installer (with any code examples you've provided)
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
silverstripe/installer
(with any code examples you've provided)PRs