Accessing WMS via http-proxy

Skip to first unread message
Assigned to by me

Nahuel Iglesias

Mar 23, 2022, 5:06:54 PM3/23/22
to mapstore-users
Hi @all, greetings from Argentina

I'm working with GeoServer an Mapstore on 2 different Docker containers.
Container names are "geoserver" and "mapstore" (I'm super creative, I know). So, the Mapstore container can resolve the Geoserver container's IP using "geoserver" as name.

I can access WFS data stored on Geoserver from Mapstore by adding the service in Mapstore's catalog using:

As I can see from the browser developer's console, the Mapstore frontend is accessing this data using http-proxy and all works OK.

BUT: when I try to acces WMS data, using:

in the browser console I see Mapstore accessing WMS "GetCapabilities" request using http-proxy:

So far so good. I can search for WMS layers and get a listing.
Then, when I select and add a layer to the Mapstore map, the following happens:

 - "DescribeLayer" request is correctly retrieved using http-proxy

- "GetMap" request is NOT using http-proxy and tries to access the Geoserver directly, which obviously is not resolving the "geoserver" name as it is unkown by that name outside the Docker network, and so the request fails and no image is shown on the map:

(URL abbreviated for simplicity)

I could not find any documentation on how to configure what information the front-end should retrieve using http-proxy and what other information directly.

Where should I look at? How can I have ALL requests to "geoserver" go through http-proxy?

Lorenzo Natali

Mar 24, 2022, 1:27:29 PM3/24/22
to mapstore-users
MapStore uses the proxy only when necessary. 
In particular it is used only when the request is not allowed by the same origin policy. 
Images do not have this restriction, so they are not proxied at all. 

I suggest instead to expose geoserver to the path "/geoserver" and mapstore to the path "/mapstore" on same port ( 80 or whatever) of a 3rd nginx or apache docker instance.
So you can configure the catalog as "/geoserver/" (relative URL) and avoid the proxy at all for your application.

Don't forget to set geoserver proxy base URL accordingly to allow to properly generate capaiblities document with the correct domain. 
This helps also to port the installation between different  domains. 

Nahuel Iglesias

Apr 1, 2022, 10:54:58 AM4/1/22
to mapstore-users
This worked like a charm - thanks!

Steven Graham

Oct 26, 2022, 2:57:22 PM10/26/22
to mapstore-users
Would have a a copy of the compose file that you have working? I have not been able to get a working compose file with both geoserver and mapstore.
Reply all
Reply to author
0 new messages