These variables are referenced in the setup instructions below to avoid hardcoding values unnecessarily.
REQUEST_LOGS_S3_REGION: AWS region hosting the request logs S3 bucket
REQUEST_LOGS_S3_BUCKET: Name of the S3 bucket that Fastly will send request logs to
REQUEST_LOGS_ROLE_ARN: The ARN of the policy that grants Fastly's AWS account permission to write into the S3 request logs bucket
Create a new bucket using AWS web console.
- Bucket name:
${REQUEST_LOGS_S3_BUCKET}
- ACLs disabled
- Block all public access
- Bucket versioning: Disable
Leave all other settings with their default values.
This is a simplified version of Fastly's instructions.
- Create a new policy using the JSON editor:
{
"Version": "2012-10-17",
"Statement": {
"Effect": "Allow",
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::${REQUEST_LOGS_S3_BUCKET}/*"
}
}
- Name: WriteAccessToRubyforgeOrgFastlyLogsS3Bucket
- Description: Grants write access to the
${REQUEST_LOGS_S3_BUCKET}
S3 bucket. Intended to be used by an IAM Role that grants the Fastly AWS account access to our account.
- Click "Create role"
- Choose "AWS account"
- Choose "Another AWS account"
- Enter "717331877981" as the Account ID (This is Fastly's AWS ID)
- Check "Require external ID"
- Enter Ruby Central's Fastly Customer ID (available at https://manage.fastly.com/account/company) as the "External ID"
- Click "Next"
- Check the "WriteAccessToRubyforgeRedirectLogsS3Bucket" Policy created in the previous step
- Click "Next"
- Role name: "RubyCentralFastlyLogStreaming"
- Role description: Allows Fastly AWS account to stream logs from Ruby Central's Fastly account.
- Click "Create role"
- Find and click on the new role in the list
- Make a note of the ARN (
${REQUEST_LOGS_ROLE_ARN}
) as we need this when setting up Log Streaming in Fastly
- Configure GitHub Pages to publish from the gh-pages branch in this repository
- Set the custom domain of the GitHub Pages site to redirects-origin.rubyforge.org so that it can be used as the origin in Fastly
- Configure redirects-origin.rubyforge.org as a CNAME pointing to rubycentral.github.io (this assumes that the GitHub Pages site is in the Ruby Central account)
- *.rubyforge.org
- rubyforge.org
- Name: github-pages
- Address: redirects-origin.rubyforge.org
- Enable TLS: Yes
- Verify certificate?: Yes
- Certificate hostname: redirects-origin.rubyforge.org
- SNI hostname: redirects-origin.rubyforge.org
- Override host: redirects-origin.rubyforge.org
Leave all other settings with their default values.
- Domain: rubyforge.org
- Status: 301
Leave all other settings with their default values.
Click "Create endpoint" and then "Create endpoint" next to "Amazon S3".
- Name: S3
- Bucket name:
${REQUEST_LOGS_S3_BUCKET}
- Domain: s3.
${REQUEST_LOGS_S3_REGION}
.amazonaws.com - Access method: IAM role
- IAM role:
${REQUEST_LOGS_ROLE_ARN}
Click "+Create snippet".
- Name: Match redirect
- Type (placement of snippet): within subroutine - recv (vcl_recv)
- VCL: content of config/match-redirects.vcl
Click "+Create snippet".
- Name: Match redirect
- Type (placement of snippet): within subroutine - error (vcl_error)
- VCL: content of config/handle-redirects.vcl
curl -I http://151.101.0.204 -H"Host: gems.rubyforge.org"
# Should 301 redirect to https://rubygems.org
curl -I http://151.101.0.204 -H"Host: rubyforge.org"
# Should 301 redirect to http://www.rubyforge.org
curl -I http://151.101.0.204 -H"Host: mocha.rubyforge.org"
# Should 301 redirect to https://github.com/freerange/mocha
When rubyforge.org was active it was only available using http, and gems.rubyforge.org is still only available using http so we're configuring http-only DNS to point to Fastly:
rubyforge.org. A 151.101.0.204
rubyforge.org. A 151.101.64.204
rubyforge.org. A 151.101.128.204
rubyforge.org. A 151.101.192.204
*.rubyforge.org CNAME nonssl.global.fastly.net.