Skip to content

fix(web): weather map tiles load under no-referrer - #973

Merged
frahlg merged 1 commit into
masterfrom
cursor/osm-map-referrer-0586
Aug 23, 2026
Merged

fix(web): weather map tiles load under no-referrer#973
frahlg merged 1 commit into
masterfrom
cursor/osm-map-referrer-0586

Conversation

@frahlg

@frahlg frahlg commented Aug 23, 2026

Copy link
Copy Markdown
Member

Accepted text proposal

Issue or Discussion: user report of the Weather settings map showing OSM “Access blocked. Referer is required” tiles.

Maintainer comment that accepted this scope: in-tree bugfix from a production screenshot; not an external contribution.

What changed

Leaflet on Settings → Weather now sets referrerPolicy: "strict-origin-when-cross-origin" on the OSM tile layer. Tile <img> requests send the origin (http://192.168.x.x:8080) and not the path. The global Referrer-Policy: no-referrer header is unchanged. Cache-buster on weather.js bumped so existing boxes pick up the script.

Why

The box sends Referrer-Policy: no-referrer on every HTTP response (intentional: do not leak the local URL to third parties). OSM’s volunteer tile servers now enforce their long-standing rule that web pages must send a Referer. Without one they still return HTTP 200, but the body is their “Access blocked” PNG (x-blocked header). That is the screenshot.

Leaflet 1.9.4 already applies options.referrerPolicy to each tile image, which overrides the document policy for those requests only. OSM and Leaflet both recommend strict-origin-when-cross-origin.

Checked against tile.openstreetmap.org from this environment (browser UA):

  • no Referer → 200, blocked PNG, x-blocked: Access denied
  • Referer: http://192.168.1.50:8080/ → 200, real map tile

Boundaries and safety

  • Does not relax the global no-referrer header.
  • Does not proxy tiles through the box.
  • Does not switch tile provider.
  • Location still has to leave the LAN to render OSM tiles; that was already true. Only the origin is now visible to OSM, which is what they require.
  • Draft feat(web): draw your PV arrays on the map #826 (feat(web): draw your PV arrays on the map) also edits web/settings/tabs/weather.js. This change is the tileLayer option plus a comment; that branch can rebase.

Verification

  • node --test web/leaflet-vendor.test.mjs — 3 pass, including a source assertion that the weather map sets the Leaflet referrerPolicy and still uses tile.openstreetmap.org.
  • Live OSM fetch with/without Referer as above.
  • Needs a human look at Settings → Weather in a browser: the map should show streets, not the blocked-tile mosaic. I could not drive the on-box UI from this environment.

Checklist

  • The diff implements one accepted scope and does not add follow-on work.
  • I checked open pull requests that touch the same files.
  • Tests cover the changed behaviour and its failure path.
  • A human reviewed every changed web/UI view in a browser, or no UI changed.
  • A Changeset is included, or the change is exempt.
  • Every commit has a DCO sign-off.
Open in Web Open in Cursor 

The box sends Referrer-Policy: no-referrer on every response. OSM's
volunteer tile servers now require a Referer from web pages, so the
location picker rendered their "Access blocked" tiles. Leaflet already
supports a per-image referrerPolicy; set it on this layer only so the
rest of the UI stays no-referrer.
@frahlg
frahlg marked this pull request as ready for review August 23, 2026 12:32

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 768e8c632d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +18 to +21
assert.match(weather, /tile\.openstreetmap\.org/);
assert.match(weather, /referrerPolicy:\s*"strict-origin-when-cross-origin"/);
const leaflet = readFileSync(join(vendor, 'leaflet.js'), 'utf8');
assert.match(leaflet, /typeof this\.options\.referrerPolicy/);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Validate the referrer override in a browser

For FTW pages served with the global Referrer-Policy: no-referrer header, these regex assertions only prove that the option and Leaflet assignment exist; they do not verify that a browser actually sends the Referer or that OSM renders real tiles. The test still passes if the original blocked-tile behavior remains, so this UI fix needs the required human browser inspection of Settings → Weather rather than being treated as behaviorally verified.

AGENTS.md reference: AGENTS.md:L90-L91

Useful? React with 👍 / 👎.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approved: Cursor Bugbot completed with no findings that need human review, and no approval policy requires a human reviewer. No reviewers were assigned.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router and Approver

@frahlg
frahlg merged commit 33bd6ca into master Aug 23, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants