GeoNode / geonode

GeoNode is an open source platform that facilitates the creation, sharing, and collaborative use of geospatial data.
https://geonode.org/
Other
1.45k stars 1.13k forks source link

GeoServer printing module - Error while download PDF #11077

Open obediobadiah opened 1 year ago

obediobadiah commented 1 year ago

I installed Geonode and Geoserver perfectly. And I configured nginx proxy to run on https

So far it worked:

The print module configuration file in GEOSERVER_DATA_DIR/printing/config.yaml is created and I can see access the https://mydomainname/geoserver/pdf/info.json

And I can see printURL: https://mydomainname/geoserver/pdf/print.pdf and createURL: https://mydomainname/geoserver/pdf/create.json Parameters in info.json

Here is my config.yaml


#===========================================================================
# allowed DPIs
#===========================================================================
dpis:
  - 96
  - 150
  - 300

#===========================================================================
# the allowed scales
#===========================================================================
scales:
  - 0.35
  - 0.7
  - 1.5
  - 3.5
  - 7.0
  - 15.0
  - 35.0
  - 70.0
  - 150.0
  - 273.0
  - 546.0
  - 1093.0
  - 2187.5
  - 4375.0
  - 8750.0

outputFilename: 'GeoNode-Map-${date}.pdf'
#== ms2 ===== 
disableScaleLocking: true
#======
brokenUrlPlaceholder: 'default'
# brokenUrlPlaceholder: 'throw'

proxyBaseUrl: https://mydomainname/geoserver/pdf
connectionTimeout: 2000
socketTimeout: 2000

#===========================================================================
# the list of allowed ips
#===========================================================================
hosts:
  - !ipMatch
    ip: 127.0.0.1
  - !localMatch
    dummy: true
  - !acceptAll
    dummy: true
  - !dnsMatch
    host: mydomainname
    port: 80
  - !dnsMatch
    host: localhost
    port: 80

Here is the NGINX Configuration:

server {

  root /var/www/html;
  index index.html index.htm index.nginx-debian.html;

  server_name mydomainname;

  charset utf-8;

  etag on;
  expires $expires;
  proxy_read_timeout 600s;
  # set client body size to 2M #
  client_max_body_size 50000M;

  location / {
    etag off;
    uwsgi_pass 127.0.0.1:8000;
    uwsgi_read_timeout 600s;
    include uwsgi_params;
    proxy_pass http://localhost:8000/;
    include proxy_params;
  }

  location /geoserver {
    proxy_pass http://geoserver_proxy;
    include proxy_params;
    etag off;
    uwsgi_pass 127.0.0.1:8000;
    uwsgi_read_timeout 600s;
    include uwsgi_params;
  }

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/mydomainname/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/mydomainname/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

But when I generate the pdf the getURL parameter from create.json url comes with HTTP instead of HTTPS

http://mydomainname/geoserver/pdf/18439792855979453446.pdf.printout

Please help me to get the pdf URL with the HTTPS schema. Thanks

afabiani commented 1 year ago

Hi @obediobadiah in the case you have a JAVA_OPTS variable named -DPRINT_BASE_URL=http://mydomainname/geoserver/pdf that one takes precedence over the config.yaml file

obediobadiah commented 1 year ago

Thanks for your comment @afabiani, so do I need to delete that variable?

obediobadiah commented 1 year ago

@afabiani I unset the JAVA_OPTS variable but the issue still persists. Can you please help

afabiani commented 1 year ago

I would set that variable with the correct public url instead

obediobadiah commented 1 year ago

I set the GEOSERVER_JAVA_OPTS variable to the correct url already but still the same Everything is working perfectly on the public URL exept the pdf URL fetched in create.json file...

afabiani commented 1 year ago

Uhm that's very strange... can you make a last try completely remove the line proxyBaseUrl form the config.yaml?

Also please double check the you have correctly set the proxyBaseUrl property of GeoServer from the global.xml file.

obediobadiah commented 1 year ago

Hello @afabiani, I deleted the proxyBaseUrl from the config.yaml but the issue still persist...

kikislater commented 8 months ago

proxyBaseUrl should be setup not deleted !