Skip to content

Commit 3eadeb6

Browse files
authored
docs: add note about 301 redirects
1 parent 2dc9e58 commit 3eadeb6

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,22 @@ private static $extensions = [
276276

277277
A UUID will be generated on an objects `onBeforeWrite()` .
278278

279+
## FAQ
280+
281+
### I'm getting a 301 redirect when trying to call my api/endpoint
282+
283+
In Silverstripe 5 `CanonicalURLMiddleware` is enabled to add a trialing
284+
slash by default. This can cause issues in production so we recommend
285+
disabling this completely for any API routes.
286+
287+
```yml
288+
SilverStripe\Core\Injector\Injector:
289+
SilverStripe\Control\Middleware\CanonicalURLMiddleware:
290+
properties:
291+
enforceTrailingSlashConfigIgnorePaths:
292+
- 'api/'
293+
```
294+
279295
## API Documentation
280296
281297
Todo but it's not massive. See `ApiController` for now.

0 commit comments

Comments
 (0)