Commit 154a497
fix(nginx): add general redirect to remove trailing slashes (#2225)
Adds a location block to remove trailing slashes from all URLs (except
root /). This fixes the 404 error when accessing URLs like /api/v2/ with
a trailing slash.
Uses a regex location block instead of a rewrite rule for clearer
processing precedence. Exact match locations (e.g., location = /sdk/js/)
take priority over this regex, so existing handlers are unaffected.
Slack thread:
https://apify.slack.com/archives/C0L33UM7Z/p1770281199186039
https://claude.ai/code/session_01GqcrG6JU9Y1YaSA5ns87Yz
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Simple Nginx routing change; main risk is unexpected redirects for
endpoints that intentionally rely on trailing slashes.
>
> **Overview**
> Adds a global Nginx `location` regex that **redirects any non-root URL
ending in `/` to the same path without the trailing slash**.
>
> This prevents 404s for requests like `/api/v2/` while keeping explicit
exact-match locations (e.g., `location = /sdk/js/`) higher priority than
the new catch-all redirect.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
99d352c. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent dd83eaf commit 154a497
1 file changed
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
37 | 43 | | |
38 | 44 | | |
39 | 45 | | |
| |||
460 | 466 | | |
461 | 467 | | |
462 | 468 | | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | 469 | | |
467 | 470 | | |
468 | 471 | | |
| |||
0 commit comments