Skip to content

Map Styles paths redirection #1005

Closed
Closed

Description

@Rub21

It seems there wasn't a ticket created for this — or perhaps I missed it — but I’ve fixed the issue with map styles not loading currently on the staging.

The problem was due to outdated paths still being used by the Wiki and some third-party apps. For example, there are still referencing map-styles/main/main.json, but the correct and updated path is now map-styles/historical/historical.json.

To resolve this, I updated the Apache configuration in the web container to include proper redirection rules. These are now in place:

  • https://staging.openhistoricalmap.org/map-styles/main/main.json → /map-styles/historical/historical.json
  • https://staging.openhistoricalmap.org/map-styles/rail/rail.json → /map-styles/railway/railway.json
  • https://staging.openhistoricalmap.org/map-styles/japanese_scroll/ohm-japanese-scroll-map.json → /map-styles/japanese_scroll/japanese_scroll.json
  • https://staging.openhistoricalmap.org/map-styles/woodblock/woodblock.json → no changes

Ref #992

Activity

  1. added
    API
    website
    on Mar 28, 2025
  2. Rub21 commented on Apr 1, 2025

    @Rub21
    MemberAuthor

    I was trying to redirect the old map-style URLs like /map-styles/main/main.json to the new ones using a 301 redirect. Even though I added the correct CORS headers, the browser kept blocking the request due to security restrictions with redirects.

    Image

    I tested several solutions, and while everything worked fine with curl, the browser still failed.

    So, I decided to use permanent URLs directly and configured an internal rewrite on the server like this:

    # Internal rewrite without visible redirect
    RewriteRule ^/map-styles/main/main\.json$ /map-styles/historical/historical.json [PT,L]
    RewriteRule ^/map-styles/rail/rail\.json$ /map-styles/railway/railway.json [PT,L]
    RewriteRule ^/map-styles/japanese_scroll/ohm-japanese-scroll-map\.json$ /map-styles/japanese_scroll/japanese_scroll.json [PT,L]

    This avoids external redirection and makes everything work properly with CORS, so the URLs will still work while pointing to the new map-styles files. e.g staging 👇

    https://staging.openhistoricalmap.org/map-styles/main/main.json
    https://staging.openhistoricalmap.org/map-styles/rail/rail.json
    https://staging.openhistoricalmap.org/map-styles/japanese_scroll/ohm-japanese-scroll-map.json
    https://staging.openhistoricalmap.org/map-styles/woodblock/woodblock.json

    cc. @danrademacher @1ec5 @batpad

  3. reopened this on Apr 1, 2025
  4. moved this from Ready for Staging to In Progress in OpenHistoricalMap Dev Planningon Apr 1, 2025
  5. Rub21 commented on Apr 3, 2025

    @Rub21
    MemberAuthor

    Currently, the old map-style URLs are redirecting to their newer equivalents:

    • https://www.openhistoricalmap.org/map-styles/main/main.json →
      https://www.openhistoricalmap.org/map-styles/historical/historical.json

    • https://www.openhistoricalmap.org/map-styles/rail/rail.json →
      https://www.openhistoricalmap.org/map-styles/railway/railway.json

    • https://www.openhistoricalmap.org/map-styles/japanese_scroll/ohm-japanese-scroll-map.json →
      https://www.openhistoricalmap.org/map-styles/japanese_scroll/japanese_scroll.json

    This ensures legacy links still working but referencing to the new map-styles files

  6. moved this from In Progress to Ready for Staging in OpenHistoricalMap Dev Planningon Apr 3, 2025
  7. moved this from Ready for Staging to On Staging in OpenHistoricalMap Dev Planningon Apr 8, 2025
  8. danrademacher commented on Apr 8, 2025

    @danrademacher

    Confirmed these are working as expected

  9. moved this from On Staging to In Production in OpenHistoricalMap Dev Planningon Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    APIwebsite

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions