Automattic / Automattic/jetpack

AMP map block doesn't work on non-SSL sites, and throws incorrect errors

Open
#16,945 2 comments 0 reactions 0 assignees View on GitHub
[Block] Map [Pri] Low AMP Bug
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

Basically, the issue here is that `` requires that `src=` be an https URL.

However, with our current implementation, the map's `amp-iframe` URL points to the origin (in fact, it only does this for AMP - the native version loads the map in a div and renders on a canvas)

What our implementation _should_ do is render an iframe that points directly to MapBox's iframe rendering endpoint, or even one of our own, that simply takes the marker locations and other configuration info as URL parameters.

#### Steps to reproduce the issue

1. On a site without SSL, and with AMP standard mode...
2. Add a map block
3. View the page

#### What I expected
A map

#### What happened instead
No map - nor even a map-like placeholder. Though it does warn in the editor that http is not a valid protocol for amp-iframe in the editor.

Contributor guide

Open the contributing guide

Research direction

Start with the AMP map block and trace how its amp-iframe URL is constructed; compare this with the native version's div and canvas rendering path. Reproduce the issue on a non-SSL site in AMP standard mode, then verify that the map renders without the invalid-protocol warning or related errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.