Early Access: The content on this website is provided for informational purposes only in connection with pre-General Availability Qlik Products.
All content is subject to change and is provided without warranty.
Skip to main content Skip to complementary content

Configuring GeoAnalytics server to work with a reverse proxy

Information note

Requires GeoAnalytics Server November 2019 or newer.

When you request the map script from the server, it embeds a JS object with a property containing a URL pointing to the webmap module of the map server. This URL is used as a base for getting map resources such as raster tiles and location lookups.

To create the URL, the server takes the map script request URL and truncates it at the module level. This causes a problem if the map server is behind a reverse proxy. In this case, the URL it gets from the request in will point to the internal map server and not to the externally available reverse proxy. For example, proxy.domain/prefix/... pointing to internal.server:port/... would result in the latter being used in the URL as that is the source of the request to the map server.

To solve this, you can configure the webmap config to reconstruct the original URL from request headers or use a preconfigured URL to the webmap module.

Headers

For a model URL like scheme://host:port/uri it gets each part from the following headers:

Header data
Part Header Alt. header Example
scheme X-Forwarded-Proto - https
host X-Forwarded-Host Host example.com:1234orexample.com
port X-Forwarded-Port - 1234
port X-Forwarded-Host Host example.com:1234
uri X-Original-URI - /the/remaining/path/resource.ext?and=so&on

For the port it first looks for the X-Forwarded-Port header. If it is not found, it looks to see if there is a port specified in any of the host headers. Failing that, it will use the port to which the request was made.

Module config

If you put the external URL in the webmap config it will ignore all headers etc. and only use this value as the base module URL.

Simply edit [map server home]/server3/modules/webmap5/config/WebMap5Module.xml and add an attribute called baseUrl to the root tag with the URL to the webmap module as its value (this will always be [external URL to map server base]/ravegeo/webmap5).

<?xml version="1.0" encoding="UTF-8"?> <WebMap5Module baseUrl="https://proxy.domain:1234/prefix/ravegeo/webmap5" />

Example reverse proxies

The following reverse proxy snippets have been tested and are confirmed to work. For brevity, only the relevant block is shown. The examples are for a reverse proxy that puts the map server at proxy.domain/prefix/.

Nginx

location /prefix/ { proxy_pass http://internal.map.server:8099/; proxy_set_header X-Forwarded-Host $host:$server_port; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Original-URI $request_uri; }

Apache

This example sets X-Forwarded-Host by default so that can be skipped. If the reverse proxy only changes the host and/or the port, it is enough to set ProxyPreserveHost On. Apache will then keep the Host header from the original request and the map server will get the right path.

<Location /prefix> Require all granted ProxyPass http://internal.map.server:8099 RequestHeader set X-Original-URI "expr=%{REQUEST_URI}" RequestHeader set X-Forwarded-Proto "expr=%{REQUEST_SCHEME}" </Location>

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!