<!--
	For rules that break image zoom, see AmazonAWS-breakzoom.xml.

	For other Amazon coverage, see Amazon.xml.


	CDN buckets:

		- ec7.images-amazon.com.cdn20.com

			- ec7.images-amazon.com

		- ec4.images-amazon.chinacache.net

			- ec4.images-amazon.com

		- d1ge0kk1l5kms0.cloudfront.net

			- ec[5x].images-amazon.com
			- g-ecx.images-amazon.com

		- d36cz9buwru1tt.cloudfront.net
		- s3.amazonaws.com/awsmedia/
		- s3.amazonaws.com/rodica-work/
		- images-(eu|fe|na).ssl-images-amazon.com.edgekey.net

		- ecx.images-amazon.com.c.footprint.net

			- images.amazon.com
			- images-jp.amazon.com
			- rcm-images.amazon.com

		- ec2.images-amazon.com.edgesuite.net

			- ec2.images.amazon.com

		- ec8.images-amazon.com.edgesuite.net

			- ec8.images-amazon.com

		- ec3.images-amazon.com.c.footprint.net

			- ec[13].images-amazon.com

		- g-ecx.images-amazon.com.c.footprint.net

			- g-images.amazon.com

		- z-ecx.images-amazon.com.edgesuite.net

			- z-ak.images-amazon.com

		- amazonrtl.vo.llnwd.net

			- ec6.images-amazon.com


	Nonfunctional domains:

		- cloudfront-labs.amazonaws.com		(refused)


	Problematic domains:

		- z-ak.images-amazon.com			(503, akamai)
		- (.+.)s3-website-eu-west-1.amazonaws.com
		- (.+.)s3-website-us-east-1.amazonaws.com


	Fully covered domains:

		- forums.aws.amazon.com
		- images-jp.amazon.com				(→ images-na.ssl-images-amazon.com)
		- g-images.amazon.com				(→ d1ge0kk1l5kms0.cloudfront.net)
		- webservices.amazon.com

		- amazonaws.com subdomains:

			- (.+.)s3
			- (.+.)s3-ap-northeast-1
			- (.+.)s3-ap-southeast-1
			- (.+.)s3-external-[123]
			- s3-eu-central-1
			- (.+.)s3-eu-west-1
			- (.+.)s3-sa-east-1
			- (.+.)s3-us-west-1
			- (.+.)s3-us-west-2
			- (.+.)s3-website-eu-west-1		(→ s3-eu-west-1)
			- (.+.)s3-website-us-east-1		(→ s3)

		- g-ecx.images-amazon.com			(→ d1ge0kk1l5kms0.cloudfront.net)
		- z-ak.images-amazon.com

-->
<ruleset name="Amazon Web Services">

	<target host="fls-eu.amazon.co.uk" />
	<target host="aws.amazon.com" />
	<target host="forums.aws.amazon.com" />
	<target host="docs.aws.amazon.com" />
	<target host="aws-portal.amazon.com" />
	<target host="fls-eu.amazon.com" />
	<target host="fls-na.amazon.com" />
	<target host="images.amazon.com" />
	<target host="images-jp.amazon.com" />
	<target host="webservices.amazon.com" />
		<!--
			False mixed content blocking, breaking style sheets:
							-->
		<exclusion pattern="^http://webservices\.amazon\.com/scratchpad/" />
			<test url="http://webservices.amazon.com/scratchpad/index.html" />
	<target host="*.amazonaws.com" />
		<!--
			Bloody forced redirection:

			https://mail1.eff.org/pipermail/https-everywhere-rules/2012-April/001100.html
 			https://trac.torproject.org/projects/tor/ticket/4199
											-->
		<exclusion pattern="^http://(?:static\.via\.me|img\.wired\.co\.uk|s3\.sandbaguk\.com|spiegeltv-ivms2-restapi|www\.mercyships\.org|www-prod-storage\.cloud\.caltech\.edu)\.s3\.amazonaws\.com/" />
		<!--
			Breaks soundsjustlike.com audio:
							-->
		<exclusion pattern="^http://badracket-website\.s3\.amazonaws\.com/swf/soundmanager\d_flash\d\.swf" />
		<!--
			Breaks premiumbeat.com preview player
							-->
		<exclusion pattern="^http://s3\.amazonaws\.com/pb_(sfx_)?previews/" />

		<!-- Implicit test URL for this host gets 404 when rewritten, but resources
				 other than / work. -->
		<exclusion pattern="^http://ec\.images-amazon\.com/$" />
		<test url="http://ec.images-amazon.com/" />

		<!--
			https://trac.torproject.org/projects/tor/ticket/7857

			Breaks images:
					-->
		<exclusion pattern="^http://em\.css\.s3\.amazonaws\.com/style\.css" />
		<exclusion pattern="^http://s3\.lbrcdn\.net\.s3-external-3\.amazonaws\.com/" />
		<!--
			This one looks slightly different:

				https://trac.torproject.org/projects/tor/ticket/7608
											 -->
		<exclusion pattern="^http://charts-datawrapper\.s3\.amazonaws\.com/" />
		<!--
			Breaks forecast.io radar images
							-->
		<exclusion pattern="^http://darkskysatellite(?:maps)?\.s3\.amazonaws\.com/" />
	<target host="amazonwebservices.com" />
	<target host="*.amazonwebservices.com" />
	<target host="*.images-amazon.com" />

	<!-- Zeitgeist MP3 player https://trac.torproject.org/projects/tor/ticket/7594 -->
	<exclusion pattern="^http://g-ecx\.images-amazon\.com/.*(?:[mM][pP]3|zeitgeist|digital/music)" />
		<test url="http://g-ecx.images-amazon.com/images/G/02/zeitgeist/mp3player/sprites-mp3-preview-player-sm-a._V192561915_.gif" />
		<test url="http://g-ecx.images-amazon.com/images/G/02/zeitgeist/mp3player/swf/zgMp3Player-1.0._V212273708_.swf" />
		<test url="http://g-ecx.images-amazon.com/images/G/02/zeitgeist/mp3player/mp3-preview-widget-top-rt-corner._V192561915_.gif" />
		<test url="http://g-ecx.images-amazon.com/images/G/02/zeitgeist/mp3player/dmusic-chart-sprites-1.0._V192561914_.gif" />
		<test url="http://g-ecx.images-amazon.com/images/G/02/zeitgeist/mp3player/mp3-preview-widget-top-left-corner._V192561912_.gif" />
	<!-- https://trac.torproject.org/projects/tor/ticket/7539 -->
	<exclusion pattern="^http://ecx\.images-amazon\.com/" />
	<target host="*.ssl-images-amazon.com" />


	<!--	Forced redirects:
					-->
	<rule from="^http://dis(\.resized)?\.images\.s3\.amazonaws\.com/"
		to="https://s3-eu-west-1.amazonaws.com/dis$1.images/" />
	<test url="http://dis.images.s3.amazonaws.com/" />
	<test url="http://dis.resized.images.s3.amazonaws.com/" />

	<rule from="^http://cms\.kiva\.org\.s3\.amazonaws\.com/"
		to="https://s3-us-west-1.amazonaws.com/cms.kiva.org/" />

	<rule from="^http://fls-eu\.amazon\.co\.uk/"
		to="https://fls-eu.amazon.co.uk/" />

	<rule from="^http://((?:docs|forums)\.aws|aws|aws-portal|fls-eu|fls-na|webservices)\.amazon\.com/"
		to="https://$1.amazon.com/" />

	<rule from="^http://s3(?:-website)?(-ap-(?:nor|sou)theast-1|-eu-central-\d|-(?:eu|us)-west-\d|-external-\d|-sa-east-1)?\.amazonaws\.com/"
		to="https://s3$1.amazonaws.com/" />

		<!--test url="http://s3.amazonaws.com/s3.thesyriacampaign.org/images/quote-close.png" /-->
		<test url="http://s3.amazonaws.com/assets.offerpop.com/jive/images/offerpop_logo.png" />
		<!--test url="http://s3-eu-west-1.amazonaws.com/nusdigital/image/images/19253/original/footer-shape.png" /-->
		<!--test url="http://s3-us-west-2.amazonaws.com/formget/images/login-logo.png" /-->

	<rule from="^http://static-course-assets\.s3\.amazonaws\.com/"
		to="https://static-course-assets.s3.amazonaws.com/" />
		<test url="http://static-course-assets.s3.amazonaws.com/ITE50ENU/common-ext/styles/images/landing.png" />


	<!--	Test failures were misinterpreted. .+-website-.+ no longer works, rest (seemingly) works.
														-->
	<!--rule from="^http://([\w-]+)\.s3(?:-website)?(-ap-(?:nor|sou)theast-1|-(?:eu|us)-west-\d|-external-\d|-sa-east-1)?\.amazonaws\.com/" -->
	<rule from="^http://([\w-]+)\.s3(-ap-(?:nor|sou)theast-1|-(?:eu|us)-west-\d|-external-\d|-sa-east-1)?\.amazonaws\.com/"
		to="https://$1.s3$2.amazonaws.com/" />

		<test url="http://estevaomonteiro.s3.amazonaws.com/" />
		<!--test url="http://network-pages.s3.amazonaws.com/oxfamgb/signuptofundraise.png" /-->
		<test url="http://afod.s3-ap-northeast-1.amazonaws.com/" />
		<test url="http://rangde-org-gen.s3-ap-southeast-1.amazonaws.com/" />
		<test url="http://edynaukraina.s3-eu-west-1.amazonaws.com/" />
		<test url="http://smalltell.s3-us-west-1.amazonaws.com/" />
		<!--test url="http://lawfare.s3-us-west-2.amazonaws.com/staging/styles/thumbnail/s3/pictures/picture-87-1431626511.jpg" /-->
		<test url="http://tastylounge-prod.s3-external-1.amazonaws.com/" />
		<test url="http://gestaoja.s3-sa-east-1.amazonaws.com/" />
		<!--test url="http://swyokohama.s3-website-ap-northeast-1.amazonaws.com/" /-->
		<!--test url="http://keithsbucket.s3-website-ap-southeast-1.amazonaws.com/" /-->
		<!--test url="http://grime.s3-website-eu-west-1.amazonaws.com/" /-->
		<!--test url="http://estevaomonteiro.s3-website-us-west-1.amazonaws.com/" /-->
		<!--test url="http://estevaomonteiro.s3-website-sa-east-1.amazonaws.com/" /-->

	<!--rule from="^http://([\w-]+)\.([^@:/]+)\.s3(?:-website)?(-ap-(?:nor|sou)theast-1|-(?:eu|us)-west-\d|-external-\d|-sa-east-1)?\.amazonaws\.com/"
		to="https://s3$3.amazonaws.com/$1.$2/" />
		<test url="http://www.thisisreallaw.com.s3-external-1.amazonaws.com/" />
		<test url="http://paniko.cl.s3-sa-east-1.amazonaws.com/" />
		<test url="http://goldendiskawards.jp.s3-website-ap-northeast-1.amazonaws.com/" />
		<test url="http://vidvatta.com.s3-website-ap-southeast-1.amazonaws.com/" />
		<test url="http://digitalcolourist.com.s3-website-eu-west-1.amazonaws.com/" />
		<test url="http://www.teejayvanslyke.com.s3-website-us-west-1.amazonaws.com/" />
		<test url="http://www.thisisreallaw.com.s3-website-external-1.amazonaws.com/" />
		<test url="http://www.thisisreallaw.com.s3-website-sa-east-1.amazonaws.com/" />
		<test url="http://www.ultiarchive.com.s3-website-sa-east-1.amazonaws.com/" />
		<test url="http://www.ultiarchive.com.s3-website-us-west-1.amazonaws.com/" />
		<test url="http://www.thisisreallaw.com.s3-website-us-east-1.amazonaws.com/" />
		<test url="http://www.bleedingedgebiotech.com.s3-website-us-east-1.amazonaws.com/" />
		<test url="http://robertbruce.s3-website-us-east-1.amazonaws.com/" />
		<test url="http://stinkdigital.s3-website-us-east-1.amazonaws.com/" /-->

	<!--rule from="^http://([\w-]+)\.s3-website-us-east-1\.amazonaws\.com/"
		to="https://$1.s3.amazonaws.com/" /-->

	<!--rule from="^http://([\w-]+)\.([^@:/]+)\.s3-website-us-east-1\.amazonaws\.com/"
		to="https://s3.amazonaws.com/$1.$2/" /-->
		<!--test url="http://www.ultiarchive.com.s3-website-us-east-1.amazonaws.com/" /-->

	<rule from="^http://([\w.-]+)\.s3-us-west-2\.amazonaws\.com/"
		to="https://s3-us-west-2.amazonaws.com/$1/" />

		<test url="http://blc.avatars.bucket.s3-us-west-2.amazonaws.com/3/9/8/0/4f40612e0eca17a852ff621ee5c2f729" />
		<test url="http://blc.avatars.bucket.s3-us-west-2.amazonaws.com//3/9/8/0/4f40612e0eca17a852ff621ee5c2f729" />

	<rule from="^http://s3-website-us-east-1\.amazonaws\.com/"
		to="https://s3.amazonaws.com/" />

	<rule from="^http://(?:www\.)?amazonwebservices\.com/"
		to="https://aws.amazon.com/" />

	<rule from="^http://developer\.amazonwebservices\.com/"
		to="https://developer.amazonwebservices.com/" />

	<rule from="^http://media\.amazonwebservices\.com/"
		to="https://s3.amazonaws.com/awsmedia/" />

	<rule from="^http://(?:g-images\.|(?:ec[5x]|g-ecx)\.images-)amazon\.com/"
		to="https://d1ge0kk1l5kms0.cloudfront.net/" />

	<rule from="^http://(?:(?:ec[1-8x]|z-ak)\.images-|images(?:-jp)?\.)amazon\.com/"
		to="https://images-na.ssl-images-amazon.com/" />

		<!--
			Exclusions for Amazon's Zeitgeist MP3 Player:

				https://trac.torproject.org/projects/tor/ticket/7000

		note that the second exclusion can't be scoped to
		the ssl-images-amazon domain, though it could have
		copied the crazy pattern from the rule above.
									-->
		<exclusion pattern="^http://amazon-zg\.s3\.amazonaws\.com/" />
		<exclusion pattern="^http://[^@:/]+images[^@:/]+/images/G/01/zeitgeist/mp3player" />
			<test url="http://images-na.ssl-images-amazon.com/images/G/01/zeitgeist/mp3player/swf/zgMp3Player-1.0._V212274098_.swf" />
			<test url="http://ec2.images-amazon.com/images/G/01/zeitgeist/mp3player/swf/zgMp3Player-1.0._V212274098_.swf" />
			<test url="http://ec1.images-amazon.com/images/G/01/zeitgeist/mp3player/swf/zgMp3Player-1.0._V212274098_.swf" />

	<rule from="^http://images-(eu|fe|na)\.ssl-images-amazon\.com/"
		to="https://images-$1.ssl-images-amazon.com/" />


	<test url="http://dis.images.s3.amazonaws.com/" />
	<test url="http://dis.resized.images.s3.amazonaws.com/" />
	<test url="http://cms.kiva.org.s3.amazonaws.com/" />
	<test url="http://fls-eu.amazon.co.uk/" />
	<test url="http://docs.aws.amazon.com/" />
	<test url="http://forums.aws.amazon.com/" />
	<test url="http://aws.amazon.com/" />
	<test url="http://aws-portal.amazon.com/" />
	<test url="http://fls-eu.amazon.com/" />
	<test url="http://fls-na.amazon.com/" />
	<test url="http://webservices.amazon.com/" />
	<test url="http://s3.amazonaws.com/" />
	<test url="http://s3-ap-northeast-1.amazonaws.com/" />
	<test url="http://s3-ap-southeast-1.amazonaws.com/" />
	<test url="http://s3-eu-west-1.amazonaws.com/" />
	<test url="http://s3-us-west-1.amazonaws.com/" />
	<test url="http://s3-external-1.amazonaws.com/" />
	<test url="http://s3-sa-east-1.amazonaws.com/" />
	<test url="http://s3-website-ap-northeast-1.amazonaws.com/" />
	<test url="http://s3-website-ap-southeast-1.amazonaws.com/" />
	<test url="http://s3-website-eu-west-1.amazonaws.com/" />
	<test url="http://s3-website-us-west-1.amazonaws.com/" />
	<test url="http://s3-website-sa-east-1.amazonaws.com/" />
	<test url="http://s3-website-us-east-1.amazonaws.com/" />
	<test url="http://amazonwebservices.com/" />
	<test url="http://www.amazonwebservices.com/" />
	<test url="http://developer.amazonwebservices.com/" />
	<test url="http://media.amazonwebservices.com/" />
	<test url="http://g-images.amazon.com/" />
	<test url="http://ec5.images-amazon.com/" />
	<test url="http://ecx.images-amazon.com/" />
	<test url="http://g-ecx.images-amazon.com/" />
	<test url="http://ec1.images-amazon.com/" />
	<test url="http://ec2.images-amazon.com/" />
	<test url="http://ec3.images-amazon.com/" />
	<test url="http://ec4.images-amazon.com/" />
	<test url="http://ec5.images-amazon.com/" />
	<test url="http://ec6.images-amazon.com/" />
	<test url="http://ec8.images-amazon.com/" />
	<test url="http://ecx.images-amazon.com/" />
	<test url="http://z-ak.images-amazon.com/" />
	<test url="http://images.amazon.com/" />
	<test url="http://images-jp.amazon.com/" />
	<test url="http://images-eu.ssl-images-amazon.com/" />
	<test url="http://images-fe.ssl-images-amazon.com/" />
	<test url="http://images-na.ssl-images-amazon.com/" />
	<test url="http://static.via.me.s3.amazonaws.com/" />
	<test url="http://img.wired.co.uk.s3.amazonaws.com/" />
	<test url="http://s3.sandbaguk.com.s3.amazonaws.com/" />
	<test url="http://spiegeltv-ivms2-restapi.s3.amazonaws.com/" />
	<test url="http://www.mercyships.org.s3.amazonaws.com/" />
	<test url="http://www-prod-storage.cloud.caltech.edu.s3.amazonaws.com/" />
	<test url="http://badracket-website.s3.amazonaws.com/swf/soundmanager1_flash1.swf" />
	<test url="http://em.css.s3.amazonaws.com/style.css" />
	<test url="http://s3.lbrcdn.net.s3-external-3.amazonaws.com/" />
	<test url="http://charts-datawrapper.s3.amazonaws.com/" />
	<test url="http://darkskysatellite.s3.amazonaws.com/" />
	<test url="http://darkskysatellitemaps.s3.amazonaws.com/" />
	<test url="http://ecx.images-amazon.com/" />
	<test url="http://amazon-zg.s3.amazonaws.com/" />
	<test url="http://s3.amazonaws.com/pb_previews/" />
	<test url="http://s3.amazonaws.com/pb_sfx_previews/" />

</ruleset>
