Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Usage of --base-path CLI option #1415

Closed
simonxbrnd opened this issue Jul 12, 2024 · 3 comments · Fixed by #1420
Closed

Usage of --base-path CLI option #1415

simonxbrnd opened this issue Jul 12, 2024 · 3 comments · Fixed by #1420
Labels

Comments

@simonxbrnd
Copy link

I use Martin 0.14.2 with the CLI. I want to expose my API on 0.0.0.0:3000 with the prefix path /tileserver because I have a gateway and I want to expose several resources on my gateway, including the Martin tileserver connected to my database.

I launched the server using the command martin --base-path /tileserver, but it doesn't work as I understand it:

  • The catalog is still reachable from 0.0.0.0:3000/catalog (no problem with that).
  • Any TileJSON URL for a given tile source or function layer is reachable from 0.0.0.0:3000/my_super_source, even though the documentation explicitly mentions that the --base-path option will "Set TileJSON URL path prefix".
  • What's more, the tiles key for a given source or function layer indicates that my --base-path is taken into account:
{
  "tilejson": "xxx",
  "tiles": [
    "https://MY_DNS/tileserver/my_super_source/{z}/{x}/{y}"
  ],
  ...
}

When I request https://MY_DNS/tileserver/my_super_source/{z}/{x}/{y}, I get a 404 response, but when I request https://MY_DNS/tileserver/my_super_source/{z}/{x}/{y}, the server responds with a 20X.

To achieve what I want, should I use the --base-path option or use an Nginx server?

@nyurik
Copy link
Member

nyurik commented Jul 12, 2024

base-path only modifies the JSON (TileJSON) returned. It does not change the path structure. You would only use it when you have a proxy in front of martin that "rewrites URLs" - i.e. converts external http://example.org/foo/bar/z/x/y into internal one like http://localhost:3000/bar/z/x/y. Moreover, it is not a recommended way - usually most proxies would set some headers to inform Martin what the original schema, host, and path should be -- see example for nginx

@nyurik
Copy link
Member

nyurik commented Jul 12, 2024

P.S. I think you have a typo in https://MY_DNS/tileserver/my_super_source/{z}/{x}/{y} -- which is written twice identically

@simonxbrnd
Copy link
Author

simonxbrnd commented Jul 12, 2024

Sorry, here is the corrected version : "When I request https://MY_DNS/tileserver/my_super_source/{z}/{x}/{y}, I get a 404 response, but when I request https://MY_DNS/my_super_source/{z}/{x}/{y}, the server responds with a 20X."

But with your example I can understand the behavior

nyurik pushed a commit that referenced this issue Jul 15, 2024
As noted, the option could likely be more explicite in what it does

Resolves #1415
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants