Skip to content
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

Only inject runtime-host meta tag if host is given #855

Merged
merged 1 commit into from
Jul 8, 2020

Conversation

sebastianbenz
Copy link
Collaborator

  • Only include host in runtime-host meta tag
  • Print warning if ampUrlPrefix is not absolute
  • Don't inject runtime-host meta tag if ampUrlPrefix is not absolute.
    This will fallback to cdn.ampproject.org.

* Only include host in runtime-host meta tag
* Print warning if ampUrlPrefix is not absolute
* Don't inject runtime-host meta tag if ampUrlPrefix is not absolute.
This will fallback to cdn.ampproject.org.
@sebastianbenz sebastianbenz merged commit 5c15f11 into main Jul 8, 2020
@sebastianbenz sebastianbenz deleted the fix-runtime-host2 branch July 8, 2020 09:05
tharders pushed a commit that referenced this pull request Aug 17, 2020
* Only include host in runtime-host meta tag
* Print warning if ampUrlPrefix is not absolute
* Don't inject runtime-host meta tag if ampUrlPrefix is not absolute.
This will fallback to cdn.ampproject.org.
versionlessHost = '.';
try {
const url = new URL(host);
this._addMeta(head, 'runtime-host', url.origin);
Copy link
Contributor

Choose a reason for hiding this comment

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

This introduced a regression. It used to be possible to specify a host like https://example.com/amp-runtime. This strips away /amp-runtime, resulting in incorrect URLs for dynamically loaded extensions.

mdmower added a commit to mdmower/amp-toolbox that referenced this pull request Oct 3, 2021
PR ampproject#855 introduced two regressions:

- It became impossible to specify a runtime-host with a path in the URL
  (e.g. https://example.com/amp-runtime)
- The --rtv flag led to inconsistent AMP script URLs because
  runtime-host dropped /rtv/<rtv>

One of the advertised features of self-hosting from
https://github.com/ampproject/amphtml/blob/main/docs/spec/amp-framework-hosting.md
is:

- serve AMP pages and the framework from the same host, potentially improving content delivery times.

For this to be possible, the runtime should be served from a path under
the same domain as the amp pages.
sebastianbenz pushed a commit that referenced this pull request Oct 4, 2021
PR #855 introduced two regressions:

- It became impossible to specify a runtime-host with a path in the URL
  (e.g. https://example.com/amp-runtime)
- The --rtv flag led to inconsistent AMP script URLs because
  runtime-host dropped /rtv/<rtv>

One of the advertised features of self-hosting from
https://github.com/ampproject/amphtml/blob/main/docs/spec/amp-framework-hosting.md
is:

- serve AMP pages and the framework from the same host, potentially improving content delivery times.

For this to be possible, the runtime should be served from a path under
the same domain as the amp pages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants