ampproject / ampproject/amphtml
Local server port not set correctly for frame.max.html when debugging with Chrome plugin
- Dominant language
- JavaScript
- Stars
- 14.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
I'm using the amp built-in Chrome plugin to test local amp sources (testing an ads provider) on a live site with the following settings:

and get the following error in the network:

That is caused by the incorrect src generated for the frame:
incorrect: `http://ads.localhost/dist.3p/current/frame.max.html`
instead of:
correct: `http://ads.localhost:8000/dist.3p/current/frame.max.html` (mind the port)
I've back traced the error to the following line, where it seems like the port is not set correctly:
https://github.com/ampproject/amphtml/blob/190a7ea1a7d7f5de2dda45dda1f738b00967d54e/src/3p-frame.js#L299
If I manually set the correct src for the frame inside the `amp-ad-0.1.js` (via local overrides)

Everything starts working fine.
In the sources that`s the place: https://github.com/ampproject/amphtml/blob/42c3b1de1ad3474ed47b047208fb1bb3f570dbcc/extensions/amp-ad/0.1/amp-ad-xorigin-iframe-handler.js#L289
Other sources are correclty handled by the plugin and served from the correct domain:port:

Is this an issue or am I missing smth?
Contributor guide
Research direction
Reproduce the local AMP setup with the built-in Chrome plugin and inspect src/3p-frame.js around line 299 and extensions/amp-ad/0.1/amp-ad-xorigin-iframe-handler.js around line 289. Compare the generated frame.max.html URL with the correctly handled sources. Done means the frame URL preserves the local server port, such as :8000, when debugging local AMP sources.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- devtools, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100