pg_featureserv icon indicating copy to clipboard operation
pg_featureserv copied to clipboard

Confirming Implementation of URLBASE and BASEPATH?

Open brettpalmberg opened this issue 3 years ago • 9 comments

Question / Bug?

Hosting pg_featureserv at a non-root path required including the path parameter (e.g. /features) in both the UrlBase and BasePath config params to get URLs and JSON values to form correctly. It felt redundant to have to include the BasePath in both variables, but wanted to confirm whether this is the intended behavior before calling anything a bug.

Example (this works)

To host pg_featureserv at localhost:9000/features/ for example, the following environment variables are required to make all .html links and JSON-built urls work correctly:

  • PGFS_SERVER_URLBASE=http://localhost:9000/features
  • PGFS_SERVER_BASEPATH=/features

What I expected (this does not work)

  • PGFS_SERVER_URLBASE=http://localhost:9000
  • PGFS_SERVER_BASEPATH=/features

Thank you.

brettpalmberg avatar Aug 01 '22 20:08 brettpalmberg

Related to #109. I was able to confirm that the behavior of URLBASE and BASEPATH configuration parameters behave differently between pg_tileserv and pg_featureserv. pg_tileserv behaves as described in the section What I expected (this does not work) above.

brettpalmberg avatar Aug 02 '22 18:08 brettpalmberg

Thanks, @brettpalmberg . I agree that having no redundancy between URLBASE and BASEPATH is desirable. And so is compatibility between pg_featureserv and pg_tileserv. We'll investigate making this change.

dr-jts avatar Aug 02 '22 19:08 dr-jts

Excellent, thanks for your response @dr-jts! Feel free to @ me if there's anything I can contribute. I wasn't familiar enough with the codebase just yet to be comfortable jumping-in :)

brettpalmberg avatar Aug 02 '22 21:08 brettpalmberg

Can these environment variables be passed to the docker container?

rhewy avatar Nov 07 '22 19:11 rhewy

Yes! Note that a Configuration.Variable will get converted into a PGFS_CONFIGURATION_VARIABLE if you catch my drift. There's a standard prefix (PGFS_) and everything gets caps'ed and underscored. But you can use normal environment variable passing to send the variable into docker or podman.

pramsey avatar Nov 07 '22 20:11 pramsey

So in a docker env file would I? PGFS_SERVER_URLBASE=https://vm103.athena.bcit.ca/pgfs PGFS_SERVER_BASEPATH=/pgfs

or

SERVER_URLBASE=https://vm103.athena.bcit.ca/pgfs SERVER_BASEPATH=/pgfs

rhewy avatar Nov 07 '22 20:11 rhewy

The former

On Mon, Nov 7, 2022 at 12:29 PM Robert Hewlett @.***> wrote:

So in a docker env file would I? PGFS_SERVER_URLBASE=https://vm103.athena.bcit.ca/pgfs PGFS_SERVER_BASEPATH=/pgfs

or

SERVER_URLBASE=https://vm103.athena.bcit.ca/pgfs SERVER_BASEPATH=/pgfs

— Reply to this email directly, view it on GitHub https://github.com/CrunchyData/pg_featureserv/issues/119#issuecomment-1306149753, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA3ZWY74JROPSR34N3JJWLWHFRENANCNFSM55I2WA2Q . You are receiving this because you commented.Message ID: @.***>

pramsey avatar Nov 07 '22 20:11 pramsey

So, I have nginx as the reverse proxy for https

        location /pgfs/ {
             proxy_pass http://localhost:9000/ ;
        }

Then https://vm103.athena.bcit.ca/pgfs is a 404 However https://vm103.athena.bcit.ca/pgfs/pgfs/ Works

Then from the links on the collections page: https://vm103.athena.bcit.ca/pgfs/pgfs/collections.html

The links are missing the second /pgfs/ https://vm103.athena.bcit.ca/pgfs/collections/public.becpas.html 404 error for the above

I will try some things ...

rhewy avatar Nov 07 '22 20:11 rhewy

This worked for me:

PGFS_SERVER_URLBASE=https://vm103.athena.bcit.ca/pgfs PGFS_SERVER_BASEPATH=/

Home links work too

Thank you!

rhewy avatar Nov 07 '22 20:11 rhewy