Skip to content

Add support for a CDN in front of crates/readmes #1152

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 8, 2017

Conversation

alexcrichton
Copy link
Member

This should hopefully allow us to configure a CDN on Heroku (namely CloudFront)
to distribute crates/readmes through.

Copy link
Member

@carols10cents carols10cents left a comment

Choose a reason for hiding this comment

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

Not compiling quite yet :)

src/uploaders.rs Outdated
bucket.host(),
Uploader::readme_path(crate_name, version)
)),
Uploader::S3 { ref bucket, .. } => {
Copy link
Member

Choose a reason for hiding this comment

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

Looks like this line needs to be changed to Uploader::S3 { ref bucket, ref cdn, .. } => {

@carols10cents
Copy link
Member

@withoutboats is CloudFront reachable when using Tor?

This should hopefully allow us to configure a CDN on Heroku (namely CloudFront)
to distribute crates/readmes through.
@alexcrichton
Copy link
Member Author

Oops forgot to verify last minute change, should be fixed now. It's also worth mentioning that the motivation for this is primarily rust-lang/cargo#4670 where I was reminded that S3 is unreachable in China. The reporter there though mentioned that rust-lang.org is reachable (which uses CloudFront).

I've also historically wanted to use CloudFront instead of S3 directly for download speed and reliability, but nothing has been pressing except for the China-blocks-us-west-1 problem

@withoutboats
Copy link
Contributor

withoutboats commented Oct 30, 2017

I don't know anything about cloudfront but I know other CDNs (e.g. cloudflare) will frequently throw up captchas for tor users as a ddos mitigation. We ought to make sure the CDN will never do something like this in our use case because I expect cargo would just barf.

@alexcrichton
Copy link
Member Author

Does www.rust-lang.org work? If so it's the same CDN. I don't know if CloudFront does captchas...

@withoutboats
Copy link
Contributor

Based on this white paper I think cloudfront on its own will never intercept requests as long as we don't use a service like AWS WAF https://d0.awsstatic.com/whitepapers/DDoS_White_Paper_June2015.pdf

@carols10cents
Copy link
Member

bors: r+

bors-voyager bot added a commit that referenced this pull request Nov 8, 2017
1152: Add support for a CDN in front of crates/readmes r=carols10cents

This should hopefully allow us to configure a CDN on Heroku (namely CloudFront)
to distribute crates/readmes through.
@carols10cents carols10cents dismissed their stale review November 8, 2017 19:57

all better now

@bors-voyager
Copy link
Contributor

bors-voyager bot commented Nov 8, 2017

Build succeeded

@bors-voyager bors-voyager bot merged commit f503cfe into rust-lang:master Nov 8, 2017
@alexcrichton alexcrichton deleted the cdn branch November 9, 2017 05:05
@messense
Copy link

messense commented Nov 9, 2017

seems unable to load readme now?

Refused to connect to 'https://d19xqa3lc3clo8.cloudfront.net/readmes/cc/cc-1.0.3.html' because it violates the following Content Security Policy directive: "connect-src 'self' https://docs.rs https://crates-io.s3-us-west-1.amazonaws.com".

@carols10cents
Copy link
Member

@messense on it! Thank you for letting me know!

@carols10cents
Copy link
Member

@messense readmes are fixed now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants