ampproject / amp-by-example

DEPRECATED: AMP by Example has been merged into amp.dev
http://amp.dev
Apache License 2.0
753 stars 505 forks source link

Incorrect cache URL is generated #1214

Open ithinkihaveacat opened 6 years ago

ithinkihaveacat commented 6 years ago

The form at

https://ampbyexample.com/advanced/using_the_google_amp_cache/#amp-cache-url-format

generates an incorrect cache URL in some cases. For the URL

https://it-trend.jp/amp/attendance_management_system/ranking

it generates

https://it--trend-jp.cdn.ampproject.org/c/s/it-trend.jp/amp/attendance_management_system/ranking

however the actual URL generated by the cache is

https://2lxpkiez55rzu2pt2kc33spxb3wf4g5sfqtlv7bhkfxxilekt2gq.cdn.ampproject.org/c/s/it-trend.jp/amp/attendance_management_system/ranking

screen shot 2018-04-11 at 10 36 51 am

(The docs describe a one-way hash being used to compute the subdomain in some cases, though the actual hash function and encoding isn't described.)

ithinkihaveacat commented 6 years ago

The problem (and reason for the discrepancy) is that the generated URL has a - as both the 3rd and 4th characters, and this specific arrangement is (very surprisingly!) prohibited by RFC 5890 (search for "third").