Skip to content

Rewrite URLs with plus character for crates.io #313

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 3 commits into from
Jul 14, 2023

Conversation

jdno
Copy link
Member

@jdno jdno commented Jul 4, 2023

The CDNs for static.crates.io now rewrites URLs that contain a plus character to a properly URL-encoded version. This ensures that clients access objects in S3 in a consistent way, and avoids any issues with Amazon S3's special handling of the plus character.

See rust-lang/crates.io#4891 for more details.

jdno added 2 commits July 4, 2023 17:57
The Compute@Edge function on Fastly now rewrites URLs that contain a
plus character to a properly URL-encoded version. This ensures that
clients access objects in S3 in a consistent way, and avoids any issues
with Amazon S3's special handling of the plus character.
The CloudFront distribution for crates.io has been updated to rewrite
URLs that contain a plus character to properly URL-encode the path. This
ensures that clients access objects in S3 in a consistent way, and
avoids any issues with Amazon S3's special handling of the plus
character.
@@ -45,6 +63,12 @@ resource "aws_cloudfront_distribution" "static" {
forward = "none"
}
}

lambda_function_association {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on last ~30 days I think this would mean 339 million * $0.60/million requests - so roughly an extra ~$200/month. I think if we can switch to cloudfront functions we get 6x cheaper # ($0.10/million requests) and presumably roughly the same functionality for the redirects desired here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great suggestion! I refactored the code to use a CloudFront function instead.

Instead of using AWS Lambda functions to rewrite URLs, we are using
CloudFront functions which are simpler and cheaper.
@jdno jdno merged commit 630b2d6 into rust-lang:master Jul 14, 2023
@jdno jdno deleted the crates-4891 branch July 14, 2023 08:42
jdno added a commit to jdno/rust-simpleinfra that referenced this pull request Jul 14, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants