{"id":18871372,"url":"https://github.com/sfomuseum/go-http-protomaps","last_synced_at":"2026-02-15T15:06:11.261Z","repository":{"id":57580934,"uuid":"361004494","full_name":"sfomuseum/go-http-protomaps","owner":"sfomuseum","description":"go-http-protomaps is an HTTP middleware package for including Protomaps.js assets in web applications.","archived":false,"fork":false,"pushed_at":"2025-10-30T18:40:09.000Z","size":8745,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-30T20:36:04.013Z","etag":null,"topics":["golang","leaflet","protomaps"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sfomuseum.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-04-23T21:00:13.000Z","updated_at":"2025-10-30T18:39:20.000Z","dependencies_parsed_at":"2025-04-24T05:44:21.376Z","dependency_job_id":"3b51dfd5-279d-4b18-bc8f-a897e6701d62","html_url":"https://github.com/sfomuseum/go-http-protomaps","commit_stats":null,"previous_names":["sfomuseum/go-http-leaflet-protomaps"],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/sfomuseum/go-http-protomaps","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sfomuseum%2Fgo-http-protomaps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sfomuseum%2Fgo-http-protomaps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sfomuseum%2Fgo-http-protomaps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sfomuseum%2Fgo-http-protomaps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sfomuseum","download_url":"https://codeload.github.com/sfomuseum/go-http-protomaps/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sfomuseum%2Fgo-http-protomaps/sbom","scorecard":{"id":814087,"data":{"date":"2025-08-18","repo":{"name":"github.com/sfomuseum/go-http-protomaps","commit":"882263869ee814d52c365cddaafc368d5af05889"},"scorecard":{"version":"v5.2.1-41-g40576783","commit":"40576783fda6698350fcbbeaea760ff827433034"},"score":2.7,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#cii-best-practices"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#pinned-dependencies"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#branch-protection"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":8,"reason":"2 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2025-3503 / GHSA-qxp5-gwg8-xv66","Warn: Project is vulnerable to: GO-2025-3595 / GHSA-vvgc-356p-c3xw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T13:49:42.436Z","repository_id":57580934,"created_at":"2025-08-23T13:49:42.436Z","updated_at":"2025-08-23T13:49:42.436Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29481925,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T11:35:25.641Z","status":"ssl_error","status_checked_at":"2026-02-15T11:34:57.128Z","response_time":118,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","leaflet","protomaps"],"created_at":"2024-11-08T05:25:38.581Z","updated_at":"2026-02-15T15:06:11.246Z","avatar_url":"https://github.com/sfomuseum.png","language":"JavaScript","readme":"# go-http-protomaps\n\n![](docs/images/go-http-leaflet-protomaps-sfo.png)\n\n`go-http-protomaps` is an HTTP middleware package for including Protomaps.js (v0.15.0) assets in web applications.\n\n## Documentation\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/sfomuseum/go-http-protomaps.svg)](https://pkg.go.dev/github.com/sfomuseum/go-http-protomaps)\n\n`go-http-protomaps` is an HTTP middleware package for including Protomaps.js assets in web applications. It exports two principal methods: \n\n* `protomaps.AppendAssetHandlers(*http.ServeMux, *ProtomapsOptions)` which is used to append HTTP handlers to a `http.ServeMux` instance for serving Protomaps JavaScript files, and related assets.\n* `protomaps.AppendResourcesHandler(http.Handler, *ProtomapsOptions)` which is used to rewrite any HTML produced by previous handler to include the necessary markup to load Protomaps JavaScript files and related assets.\n\n## Example\n\n```\npackage main\n\nimport (\n\t\"embed\"\n\t\"log\"\n\t\"net/http\"\n\t\"net/url\"\n\n\t\"github.com/sfomuseum/go-http-protomaps\"\n)\n\n//go:embed index.html sfo.pmtiles\nvar staticFS embed.FS\n\nfunc main() {\n\n\ttile_url := \"/sfo.pmtiles\"\n\n\tstatic_fs := http.FS(staticFS)\n\tstatic_handler := http.FileServer(static_fs)\n\n\tmux := http.NewServeMux()\n\n\tmux.Handle(*tile_url, static_handler)\n\t\n\tpm_opts := protomaps.DefaultProtomapsOptions()\n\tpm_opts.TileURL = *tile_url\n\n\tprotomaps.AppendAssetHandlers(mux, pm_opts)\n\t\n\tindex_handler := protomaps.AppendResourcesHandler(static_handler, pm_opts)\n\tmux.Handle(\"/\", index_handler)\n\n\terr = http.ListenAndServe(\":8080\", mux)\n}\n```\n\n_Error handling omitted for brevity._\n\n## Tools\n\n```\n$\u003e make cli\ngo build -mod vendor -o bin/example cmd/example/main.go\n```\n\n### example\n\nA simple example web application that uses the `go-http-protomaps` middleware and displays a map.\n\n```\n$\u003e ./bin/example -h\nUsage of ./bin/example:\n  -protomaps-tile-url string\n    \tA custom file://, http:// or https:// URI pointing to a valid Protomaps tiles bundle. (default \"/sfo.pmtiles\")\n  -server-uri string\n    \tA valid aaronland/go-http-server URI (default \"http://localhost:8080\")\n```\n\nThe `example` application contains an embedded Protomaps tiles database file so the easiest way to test things is like this:\n\n```\n$\u003e ./bin/example \n2021/04/28 07:45:57 Listening for requests on http://localhost:8080\n```\n\nAnd then when you open the URL `http://localhost:8080` in your web browser you should see something like this:\n\n![](docs/images/go-http-leaflet-protomaps-sfo.png)\n\nThe `example` application also supports loading `.pmtiles` databases from remote locations. For example:\n\n```\n$\u003e ./bin/example -protomaps-tile-url https://static.sfomuseum.org/pmtiles/sfo.pmtiles\n2021/04/28 07:48:11 Listening for requests on http://localhost:8080\n```\n\nIf you want to load a local file you'd do this:\n\n```\n$\u003e ./bin/example -protomaps-tile-url file:///usr/local/data/sfo.pmtiles\n2021/04/28 07:48:53 Listening for requests on http://localhost:8080\n```\n\nIn the case of `file://` URLs the `example` application will create an `http.Dir` handler for the root folder of the URL (`/usr/local/data/)` and then route the filename (`/sfo.pmtiles`) to that handler.\n\n## AWS\n\n### S3\n\nIf you are serving your Protomaps `.pmtiles` databases from an S3 bucket you'll need to make that you have `CORS` enabled for that bucket. For example:\n\n```\n[\n    {\n        \"AllowedHeaders\": [\n            \"*\"\n        ],\n        \"AllowedMethods\": [\n            \"GET\",\n            \"HEAD\"\n        ],\n        \"AllowedOrigins\": [\n            \"*\"\n        ],\n        \"ExposeHeaders\": [],\n        \"MaxAgeSeconds\": 3000\n    }\n]\n```\n\n_Be sure to allow the `HEAD` method. It took me a while to remember this was necessary the first time I set things up._\n\n### CloudFront\n\nIf you are serving your Protomaps `.pmtiles` databases from a CloudFront endpoint you'll need to make sure you do the following:\n\n* Ensure that the `Allowed HTTP Methods` setting is configured to allow \"GET, HEAD, OPTIONS\".\n* Ensure that the `Cache Based on Selected Request Headers` setting is configured to use a \"whitelist\".\n* Add the following default headers to the whitelist: `Access-Control-Request-Headers`, `Access-Control-Request-Method`, `Origin`.\n* Add the following custom headers to the whitelist: `Range`.\n\n\n## See also\n\n* https://protomaps.com/blog/new-way-to-make-maps/\n* https://github.com/protomaps/protomaps.js\n* https://github.com/aaronland/go-http-leaflet","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsfomuseum%2Fgo-http-protomaps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsfomuseum%2Fgo-http-protomaps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsfomuseum%2Fgo-http-protomaps/lists"}