EPMRPP-114309 || Fix incorrect redirect for release documentation URLs#1110
EPMRPP-114309 || Fix incorrect redirect for release documentation URLs#1110maria-hambardzumian wants to merge 2 commits into
Conversation
WalkthroughCopies a new Amplify build spec and uploads custom redirect rules during the GitHub Actions deploy-dev workflow; adds ChangesAmplify Deployment Configuration
sequenceDiagram
autonumber
actor Developer
participant GitHub as GitHub Actions Runner
participant S3 as S3 Bucket
participant Amplify as AWS Amplify Service
Developer->>GitHub: push to branch triggers deploy-dev workflow
GitHub->>S3: aws s3 sync (build) -> /tmp/full-site
GitHub->>S3: cp amplify.yml into /tmp/full-site
GitHub->>Amplify: aws amplify update-app --custom-rules file://amplify-custom-rules.json
GitHub->>Amplify: trigger redeploy using /tmp/full-site contents
Amplify->>S3: fetch site artifacts (including amplify.yml)
Amplify->>Amplify: apply custom rules and (skip build due to amplify.yml)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@amplify-custom-rules.json`:
- Line 18: The redirect rule using the regex backreference in the object with
"source": "</^([^.]+[^/])$/>" and "target": "/$1/" must be replaced because
Amplify does not support $1 backreferences; update the rule to use Amplify's
named-segment/wildcard syntax (e.g., replace with a rule that uses "<slug>" in
both "source" and "target" and keeps "status": "301") or remove this rule if
existing rules already handle trailing slashes (ensure you edit the object
containing the regex source and target values accordingly).
- Around line 14-16: The redirect rules in amplify-custom-rules.json use
colon-style named parameters in the "source" fields (e.g.,
"/docs/releases/archived-releases/:version", "/docs/releases/:version",
"/docs/installation-steps-advanced/:page") which Amplify Hosting treats as
literal text; update those "source" patterns to use angle-bracket capture syntax
by replacing ":version" with "<version>" and ":page" with "<page>" so the files
become "/docs/releases/archived-releases/<version>", "/docs/releases/<version>",
and "/docs/installation-steps-advanced/<page>" while keeping the same "status"
and "target" values.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 73a41179-2378-4419-a8b6-f17ab267207f
📒 Files selected for processing (3)
.github/workflows/deploy-dev.ymlamplify-custom-rules.jsonamplify.yml
| { "source": "/docs/releases/archived-releases/:version", "status": "301", "target": "/docs/releases/archived-releases/:version/" }, | ||
| { "source": "/docs/releases/:version", "status": "301", "target": "/docs/releases/:version/" }, | ||
| { "source": "/docs/installation-steps-advanced/:page", "status": "301", "target": "/docs/installation-steps-advanced/:page/" }, |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
AWS Amplify custom redirect rules named path parameter syntax colon ":param" vs angle bracket "<param>" official documentation
💡 Result:
In AWS Amplify Hosting redirect/rewrite rules, the “path parameter” syntax uses angle brackets like (and wildcard <>)—there is no documented support for a colon-based syntax like:param. Evidence from official AWS docs: - Amplify’s redirect examples use angle brackets for path segment capture, e.g. source "/blog//" and target "/posts//" [1]. - The official “Redirects and rewrites example reference” documents path parameter examples using angle brackets, including "/docs/<" and "/documents/<" for wildcard matching [2]. So, for your question “:param vs ”: - Use (angle brackets). Example: "/blog//" -> "/posts//" [1]. - Do not use:param; that syntax is not mentioned in the Amplify redirect/rewrite rule documentation for captured path segments [1][2]. Note: Amplify also supports a wildcard capture syntax <>, but it’s distinct from named captures like [2].
Citations:
- 1: https://docs.aws.amazon.com/amplify/latest/userguide/redirects.html
- 2: https://docs.aws.amazon.com/amplify/latest/userguide/redirect-rewrite-examples.html
🏁 Script executed:
# Search for the file amplify-custom-rules.json
find . -name "amplify-custom-rules.json" -type fRepository: reportportal/docs
Length of output: 89
🏁 Script executed:
cat -n ./amplify-custom-rules.json | sed -n '10,20p'Repository: reportportal/docs
Length of output: 966
Use angle-bracket syntax <version> and <page> instead of colon syntax
Lines 14-16 use incorrect named-parameter syntax (:version, :page). AWS Amplify Hosting requires angle brackets for path segment capture: <version> and <page>. The current syntax will cause Amplify to treat :version and :page as literal strings, silently breaking the core redirect fix for EPMRPP-114309.
🔧 Suggested correction to angle-bracket syntax
- { "source": "/docs/releases/archived-releases/:version", "status": "301", "target": "/docs/releases/archived-releases/:version/" },
- { "source": "/docs/releases/:version", "status": "301", "target": "/docs/releases/:version/" },
- { "source": "/docs/installation-steps-advanced/:page", "status": "301", "target": "/docs/installation-steps-advanced/:page/" },
+ { "source": "/docs/releases/archived-releases/<version>", "status": "301", "target": "/docs/releases/archived-releases/<version>/" },
+ { "source": "/docs/releases/<version>", "status": "301", "target": "/docs/releases/<version>/" },
+ { "source": "/docs/installation-steps-advanced/<page>", "status": "301", "target": "/docs/installation-steps-advanced/<page>/" },🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@amplify-custom-rules.json` around lines 14 - 16, The redirect rules in
amplify-custom-rules.json use colon-style named parameters in the "source"
fields (e.g., "/docs/releases/archived-releases/:version",
"/docs/releases/:version", "/docs/installation-steps-advanced/:page") which
Amplify Hosting treats as literal text; update those "source" patterns to use
angle-bracket capture syntax by replacing ":version" with "<version>" and
":page" with "<page>" so the files become
"/docs/releases/archived-releases/<version>", "/docs/releases/<version>", and
"/docs/installation-steps-advanced/<page>" while keeping the same "status" and
"target" values.
…to 200 and adjust targets to include index.html
There was a problem hiding this comment.
♻️ Duplicate comments (1)
amplify-custom-rules.json (1)
14-16:⚠️ Potential issue | 🟠 Major | ⚡ Quick winUse Amplify path-capture syntax (
<param>) instead of colon params.
Line 14,Line 15, andLine 16still use:version/:page, which Amplify treats as literal text rather than captured segments. That prevents these rewrites from matching real version/page URLs.Proposed minimal fix
- { "source": "/docs/releases/archived-releases/:version", "status": "200", "target": "/docs/releases/archived-releases/:version/index.html" }, - { "source": "/docs/releases/:version", "status": "200", "target": "/docs/releases/:version/index.html" }, - { "source": "/docs/installation-steps-advanced/:page", "status": "200", "target": "/docs/installation-steps-advanced/:page/index.html" }, + { "source": "/docs/releases/archived-releases/<version>", "status": "200", "target": "/docs/releases/archived-releases/<version>/index.html" }, + { "source": "/docs/releases/<version>", "status": "200", "target": "/docs/releases/<version>/index.html" }, + { "source": "/docs/installation-steps-advanced/<page>", "status": "200", "target": "/docs/installation-steps-advanced/<page>/index.html" },AWS Amplify Hosting custom redirect/rewrite rule syntax: are named path captures required to use angle brackets like <version> (and not :version)?🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@amplify-custom-rules.json` around lines 14 - 16, The redirect rules use colon-style params which Amplify treats as literal; update the three rule "source" patterns to use Amplify path-capture syntax by replacing ":version" and ":page" with angle-bracket captures (e.g., change "/docs/releases/archived-releases/:version" -> "/docs/releases/archived-releases/<version>", "/docs/releases/:version" -> "/docs/releases/<version>", and "/docs/installation-steps-advanced/:page" -> "/docs/installation-steps-advanced/<page>") so the rewrites for those sources correctly match and capture path segments.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Duplicate comments:
In `@amplify-custom-rules.json`:
- Around line 14-16: The redirect rules use colon-style params which Amplify
treats as literal; update the three rule "source" patterns to use Amplify
path-capture syntax by replacing ":version" and ":page" with angle-bracket
captures (e.g., change "/docs/releases/archived-releases/:version" ->
"/docs/releases/archived-releases/<version>", "/docs/releases/:version" ->
"/docs/releases/<version>", and "/docs/installation-steps-advanced/:page" ->
"/docs/installation-steps-advanced/<page>") so the rewrites for those sources
correctly match and capture path segments.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b13356fc-9e84-4f86-be55-5c9ea57c1b30
📒 Files selected for processing (1)
amplify-custom-rules.json
Summary by CodeRabbit