Open jtbaker opened 1 year ago
Have you played with
# Advertise URLs relative to this server name
# default is to look this up from incoming request headers
# UrlBase = "http://localhost/"
# Optional path to add to the service base URL
# If set, all routes will be prefixed with this path
# BasePath = "/"
https://github.com/CrunchyData/pg_tileserv/blob/master/config/pg_tileserv.toml.example
I had the same issue when the server was behind a proxy that rewrites the address. Setting BasePath
looked right, but BasePath
was used in other places that broke things. UrlBase
didn't work either when it ended with a path name (in addition to the fqdn part).
The only way I was able to get it to work was to edit util.go
near line 44 to force the return of the desired url:
func formatBaseURL(baseHost string, basePath string) string {
...
return "https://myserver.com/tiles"
}
Not pretty, but it worked.
Hi, thanks for the great tool!
I have a use case where I'd like to proxy a
pg_tileserv
deployment at a sub-route of my app, something like/tiles
to be able to use its built in authentication functionality. I'm sure I'm not the only person that may use this pattern, and the machine-readable json endpoints are quite helpful.Using the
Forwarded
,X-Forwarded-Host
andX-Forwarded-Scheme
headers works great for proxying to another bare route, updating thedetailurl
properties to have the right origin. But if I want those values to be mapped to my sub-route, the logic breaks down and I have to do some parsing/reinjection of the properties returned in the.json
endpoints to change the route to include my proxied sub-route.Could I do this using some some sort of HTTP header information that I attach in my proxied requests? It looks like it only respects the
Host
property and strips anything after that at the moment.Example header:
/index.json
returns objects like this:instead of