pramsey / pgsql-ogr-fdw

PostgreSQL foreign data wrapper for OGR
MIT License
239 stars 34 forks source link

Access to wfs source behind proxy #140

Closed jdlom closed 7 years ago

jdlom commented 7 years ago

Hi,

I can not access to wfs source behind my corporate proxy.

ogrinfo WFS:http://ws.carmen.developpement-durable.gouv.fr/WFS/8/nature? works only if I set up the environment variable http_proxy

I try to set up GDAL_HTTP_PROXY

GDAL_HTTP_PROXY=myproxy:port ogrinfo WFS:http://ws.carmen.developpement-durable.gouv.fr/WFS/8/nature? works too

But when I try to add GDAL_HTTP_PROXY to the config_options I've got an error :

CREATE SERVER nature_dreal
  FOREIGN DATA WRAPPER ogr_fdw
  OPTIONS (
    datasource 'http://ws.carmen.developpement-durable.gouv.fr/WFS/8/nature?',
    format 'WFS',
    config_options 'GDAL_HTTP_PROXY=myproxy:port');

ERREUR: unable to connect to data source "http://ws.carmen.developpement-durable.gouv.fr/WFS/8/nature?" État SQL :HV00D

I don't know if I add to set up the environment variable http_proxy for the specific postgres account and how to do this.

Best regards,

pramsey commented 7 years ago

Based on your explanation you're doing everything right. GDAL_HTTP_PROXY is in fact a ConfigOption for GDAL, so you're putting it in the right place: there is no need to use an environment variable, that's just one of the many possibilities GDAL provides for passing ConfigOptions. Sorry I cannot help further on the evidence available.

If you set set client_min_messages = debug1 you can at least watch and see ogr-fdw pick up the option from your create server command.

jdlom commented 5 years ago

Missing WFS prefix in datasource

CREATE SERVER nature_dreal
  FOREIGN DATA WRAPPER ogr_fdw
  OPTIONS (
    datasource 'WFS:http://ws.carmen.developpement-durable.gouv.fr/WFS/8/nature?',
    format 'WFS',
    config_options 'GDAL_HTTP_PROXY=myproxy:port');

Works like a charm !