Trouble download pdf with geoserver print module

291 views
Skip to first unread message

dbstore sitp

unread,
Jul 28, 2015, 7:04:53 AM7/28/15
to Heron Mapping Client Development
Hello

I have a problem with the print. I am using the Print Dialog widget with the module MapFish for Geoserver 2.5.

Here is my setup:

Apache VHost

        ProxyPass /geoserver                  http://IP_number:8090/geoserver
        ProxyPassReverse /geoserver     http://IP_number:8090/geoserver

proxy.cgi 

AllowedHost ( [IP_number: 8090],[IP_number],ecc.).

From Heron widget

GET:


response:

POST:


response:
 
Problem:

The door 8090 this url not allow you to download as PDF as it is not accessible from the outside. Is there a way to remove the port 8090 in response POST (es. http://IP_number/geoserver/pdf/4554636364577854420.pdf) so the pdf is correctly downloaded  or set a rule in ProxyPass? where did I go wrong?

Thanks for your help

Davor Racic

unread,
Jul 29, 2015, 1:01:37 AM7/29/15
to Heron Mapping Client Development, dbsto...@gmail.com
If you proxy your request for /geoserver to http://IP_number:8090/geoserver then your requests to /geoserver/pdf will bi proxied to http://IP_number:8090/geoserver/pdf, so you should use http://IP_number/geoserver/pdf as printialog url option in your Heron config.

dbstore sitp

unread,
Jul 29, 2015, 2:52:45 AM7/29/15
to Heron Mapping Client Development, dbsto...@gmail.com
hi, Davor

thanks for the reply but also by entering http://IP_number:8090/geoserver/pdf in VH Apache Proxy, download the pdf after POST fails, you always get this url: 


with port 8090 not accessible from the outside. Strange, the use of proxies should hide the use.

In config.js use the url you indicated already before. 

Greetings


Davor Racic

unread,
Jul 31, 2015, 3:44:30 AM7/31/15
to Heron Mapping Client Development, dbsto...@gmail.com
Have you entered the correct proxy base url in Geoserver global settings:

"GeoServer can have the capabilities documents report a proxy properly. The Proxy Base URL field is the base URL seen beyond a reverse proxy."

Davor Racic

unread,
Jul 31, 2015, 3:58:23 AM7/31/15
to Heron Mapping Client Development, dbsto...@gmail.com
Explanation: if you use some kind of load balancing or proxy-ing, for example you have Geoserver instances at ports 8080, 8090 etc... and you proxy through address http://myserver/geoserver, you should use that address as a proxy base url for, and always use it on the client side. If you dont't do that, requests wil get through the geoserver, but responses might have http://myserver:8080/geoserverhttp://myserver:8090/geoserver etc. in their content (capabilities lists, info.json which you need for printing etc. - use Developer tools in Chrome and find it) and vice versa - if you put correct proxy base url, but you use http://myserver:8080/geoserver on the client side, and those ports are not blocked by firewall - requests will get through geoserver but responses might have http://myserver/geoserver in their content.

Davor Racic

unread,
Jul 31, 2015, 8:34:27 AM7/31/15
to Heron Mapping Client Development, dbsto...@gmail.com
https://osgeo-org.atlassian.net/browse/GEOS-4574

So I think Geoserver printing module does not yet honour the proxy base url from Geoserver config. Possible workarounds:

1. Set "proxyBaseUrl" in config.yaml
2. Use mapfish-print v. 2.10 as a separate tomcat webapp. Download war file from: http://dev.mapfish.org/maven/repository/org/mapfish/print/print-servlet/2.1.0/ (this is what I use personally)

Best regards

dbstore sitp

unread,
Aug 4, 2015, 2:56:00 AM8/4/15
to Heron Mapping Client Development, dbsto...@gmail.com
Hi Davor

Following your instructions.....

I also think that could be resolved through tomcat's server.xml:


<Connector port = "8090" maxHttpHeaderSize = "8192"
            maxThreads = "150" minSpareThreads = "25" MaxSpareThreads = "75"
            enableLookups = "false" redirectPort = "8443" acceptCount = "100"
            connectionTimeout = "20000" disableUploadTimeout = "false"
            proxyName = "www.example.com" proxyPort = "80" />

and integrates the directive proxyName / proyPort in the xml file in webapps of geoserver I solved. Now PrintURL and createURL in GET request info.json are created correctly without 8090 port in url.

Thanks for your help
Reply all
Reply to author
Forward
0 new messages