Skip to content

Conversation

@emiliopardo
Copy link

Hello

I've had some problems when trying to use tileserver-gl through a proxy.

These problems are related to the static files located in the path "/usr/src/app/public/"

The "wmts.tmpl" file does not contemplate the use of {{public_url}}, it always uses {{base_url}}

In the index.tmpl file in the wmts section, {{public_url}} is not considered in the link to the capabilities of the service.

In the index.css file all calls to styles that have url fail because they cannot be parameterized with {{public_url}}

If these styles are removed and included within index.tmpl in the header with <style> you can use {{public_url}}

These changes are minor and make it easier to use tileserver-gl through a proxy.

Thanks

@acalcutt
Copy link
Collaborator

I Merged #605 , which sets BaseUrl to PublicUrl if the option is set. I think this should make the changes in wmts.tmpl not needed anymore.

I also merge #501 , which fixes the public url in index

I think the only part left to this change would be the css, which I'm not sure about.

@mnutt
Copy link
Contributor

mnutt commented Jan 19, 2023

I believe the font-face definitions can be left in the css file, and use relative paths to the font files.

@tonofll
Copy link

tonofll commented Jun 15, 2023

UP this PR
Although API endpoints perfectly work by using --public_url parameter, certain UI elements and links are completely broken when you place tileserver-gl behind a proxy.

image

Comment on lines -44 to +75
| <a href="/styles/{{@key}}/wmts.xml{{&../key_query}}">WMTS</a>
| <a href="{{public_url}}styles/{{@key}}/wmts.xml{{&../key_query}}">WMTS</a>
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this has been fixed long ago

@mloskot
Copy link
Contributor

mloskot commented Jan 24, 2025

@tonofll @acalcutt

UP this PR Although API endpoints perfectly work by using --public_url parameter, certain UI elements and links are completely broken when you place tileserver-gl behind a proxy.

This is weird indeed, because the public_url seems to be used across the UI template, e.g.

{{#if serving_data}}
<a href="{{public_url}}styles/{{@key}}/style.json{{&../key_query}}">GL Style</a>
{{/if}}
{{#if serving_rendered}}
{{#if serving_data}}| {{/if}}<a href="{{public_url}}styles/512/{{@key}}.json{{&../key_query}}">TileJSON</a>
{{/if}}
{{#if serving_rendered}}
| <a href="{{public_url}}styles/{{@key}}/wmts.xml{{&../key_query}}">WMTS</a>
{{/if}}

There is a peculiar issue though:

  • I'm using NGINX proxy
  • I run pass --public_url https://svc.example.com/test/tiles (or --public_url https://svc.example.com/test/tiles/, no difference)
  • I access https://svc.example.com/test/tiles and URL-s on the default frontpage are generated without the part /tiles/ like https://svc.example.com/test/styles/basic-preview/style.json instead of
    https://svc.example.com/test/tiles/styles/basic-preview/style.json
  • I access https://svc.example.com/test/tiles/ with trailing / and all URL-s on the default frontpage are correctly generated

The only issue I noticed is the missing thumbnails:
image

but that seems to be due to the URL-s missing #, I think, like here
https://svc.example.com/test/tiles/styles/basic-preview/11/1072/717.png
instead of
https://svc.example.com/test/tiles/styles/basic-preview/#11/1072/717.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants