5

I don't want to access my geoserver behind a proxy. I can access it directly. It is in same network as I with no proxy between us.

I have a Geoserver and created some layers consuming WMS services from somewhere.

My problem is that my geoserver is behind a proxy. its a governamental institution and all access to external world needs to authenticate do the proxy to go out. I need to configure it in my browser to use the internet, but need an exclusion rule in browser to access internal network (to ignore proxy).

I don't know how to tell Geoserver to login into that proxy to allow it access the outside WMS service I need to consume.

The result is as follow:

2016-05-02 10:03:59,749 ERROR [org.geoserver.ows] - 
org.geoserver.platform.ServiceException: Internal error 
    at org.geoserver.wms.GetMap.run(GetMap.java:129)
    at org.geoserver.wms.DefaultWebMapService.getMap(DefaultWebMapService.java:320)
    at sun.reflect.GeneratedMethodAccessor300.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319)
...
Caused by: java.io.IOException: Server returned HTTP error code 407 for URL http://mapas.icmbio.gov.br/i3geo/ogc.php?TEMA=uc_esec&REQUEST=GetCapabilities&VERSION=1.3.0&SERVICE=WMS
    at org.geotools.data.ows.MultithreadedHttpClient.get(MultithreadedHttpClient.java:202)
    at org.geotools.data.ows.AbstractOpenWebService.internalIssueRequest(AbstractOpenWebService.java:426)
    at org.geotools.data.wms.WebMapServer.issueRequest(WebMapServer.java:419)
    at org.geotools.data.ows.AbstractOpenWebService.negotiateVersion(AbstractOpenWebService.java:260)
    at org.geotools.data.ows.AbstractOpenWebService.<init>(AbstractOpenWebService.java:110)
    at org.geotools.data.wms.WebMapServer.<init>(WebMapServer.java:382)
    at org.geoserver.catalog.ResourcePool.getWebMapServer(ResourcePool.java:1653)
    at org.geoserver.catalog.impl.WMSStoreInfoImpl.getWebMapServer(WMSStoreInfoImpl.java:102)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.geoserver.catalog.impl.ModificationProxy.invoke(ModificationProxy.java:146)
    at com.sun.proxy.$Proxy6.getWebMapServer(Unknown Source)
    at org.geoserver.wms.GetMap.executeInternal(GetMap.java:464)
    at org.geoserver.wms.GetMap.run(GetMap.java:248)
    at org.geoserver.wms.GetMap.run(GetMap.java:119)

To go to http://mapas.icmbio.gov.br/i3geo/ogc.php?TEMA=uc_esec&REQUEST=GetCapabilities&VERSION=1.3.0&SERVICE=WMS it needs to login into same proxy I have configured in my browser (to go outside my network)

My proxy allow url auth like <user>:<password>@<proxy_address>:<port>

2016-05-02 10:03:53,627 DEBUG [org.geotools.data.ows] - Found 'http.proxyHost' Java System property. Using it as proxy server. Port: 6060
2016-05-02 10:03:53,627 DEBUG [org.geotools.data.ows] - Initialized with nonProxyHosts: [localhost, 10.5.115.122, 10.5.115.123, *.defesa.mil.br, 10.5.115.136, 10.5.115.110, 10.5.115.22, siglmd-app.defesa.mil.br]
2016-05-02 10:03:53,628 DEBUG [org.geotools.data.ows] - System property http.proxyUser and http.proxyPassword found, setting proxy auth credentials
2016-05-02 10:03:59,749 ERROR [org.geotools.data.ows] - Failed to execute request http://mapas.icmbio.gov.br/i3geo/ogc.php?TEMA=uc_esec&REQUEST=GetCapabilities&VERSION=1.3.0&SERVICE=WMS
2016-05-02 10:03:59,749 ERROR [org.geoserver.ows] - 
org.geoserver.platform.ServiceException: Internal error 
    at org.geoserver.wms.GetMap.run(GetMap.java:129)
    at org.geoserver.wms.DefaultWebMapService.getMap(DefaultWebMapService.java:320)
    at sun.reflect.GeneratedMethodAccessor300.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319)

EDIT: Strange... some links are working others don't. This service gives me a Server returned HTTP response code: 407 for URL: http://mapas.icmbio.gov.br/i3geo/ogc.php?tema=uc_esec&service=wms&request=getcapabilities and this don't: http://sigel.aneel.gov.br/arcgis/services/SIGEL/Distribuicao/MapServer/WMSServer. I conclude it is not problem in my proxy since I can go outside in some cases...

Other cases: Work:

http://sigel.aneel.gov.br/arcgis/services/SIGEL/Transmissao/MapServer/WMSServer?service=WMS&version=1.1.0&request=GetCapabilities

Don't work ( error 407 ):

http://geoportal.lneg.pt/arcgis/services/RecursosHidro/MapServer/WMSServer?request=GetCapabilities&service=WMS&version=1.1.0

Geoserver proxy auth implementaion problem? https://stackoverflow.com/questions/14113341/http-407-proxy-authentication-required-how-to-handle-in-java-code

  • Are you running GeoServer on Jetty or Tomcat? – user30184 May 3 '16 at 11:04
  • BTW. When you will get your way through the proxy you will probably find that you can't cascade layers from that service. It is MapServer and GeoServer has a problem with a combination of MapServer and WMS 1.3.0. Use WMS 1.1.1 or 1.1.0 instead. – user30184 May 3 '16 at 11:13
  • I'll check this and put here. I'm not sure now. I'm using the bundle (embedded) version. – Magno C May 3 '16 at 11:23
  • WMS 1.1.1 or 1.1.0 not worked. – Magno C May 3 '16 at 13:35
  • As I said, you must first solve the problem with proxy authentication. You will face the problem with WMS 1.3.0 only after that because GeoServer can't resolve request=GetSchemaExtensionthat comes with the GetCapabilities. – user30184 May 3 '16 at 14:06
3

You need to set the http proxy variables either using a system environment variable or through a JVM property set in catalina.sh. There are detailed steps on how to do this on the WFS Store page.

In the past there have been issues with the HTTP COnnection pooling not picking up the proxy variables so if it continues to not work try unclicking the connection pooling box.

enter image description here

  • Documentation: docs.geoserver.org/stable/en/user/data/cascaded/wfs.html. Read about "Connecting to an external WFS layer via a proxy server". – user30184 May 2 '16 at 16:31
  • Thanks. But still getting error code 407. Please see my edit 2. – Magno C May 2 '16 at 17:35
  • I've also exported http_proxy and a wget from command line (in geoserver machine) worked fine. Seems a geoserver problem. – Magno C May 2 '16 at 18:50
  • Try unclicking connection pooling in the store page – Ian Turton May 2 '16 at 18:58
  • What version? there is no connection pooling in store page. Just HTTP connection manager, and a user and password boxes. – Magno C May 2 '16 at 19:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.