OpenDRR / pygeoapi

pygeoapi is a Python server implementation of the OGC API suite of standards. The project emerged as part of the next generation OGC API efforts in 2018 and provides the capability for organizations to deploy a RESTful OGC API endpoint using OpenAPI, GeoJSON, and HTML. pygeoapi is open source and released under an MIT license.
https://pygeoapi.io
MIT License
0 stars 1 forks source link

Mixed content errors when API documentation is generating OpenAPI doc #3

Closed jvanulde closed 3 years ago

jvanulde commented 3 years ago

Fix is to edit the config to point to the local OGC Schema directory. The schemas are already being pulled into the container: https://github.com/geopython/pygeoapi/blob/master/Dockerfile#L92-L95

This would solve the issue where we are getting mixed content errors. Needs to be set here:

https://github.com/OpenDRR/pygeoapi/blob/ea8b4544bee7ce3c931b658206631fd08add24ae/pygeoapi-config.yml#L51

and here:

https://github.com/OpenDRR/pygeoapi/blob/ea8b4544bee7ce3c931b658206631fd08add24ae/docker/default.config.yml#L52

arashmalekz commented 3 years ago

This should be fixed now, but I don't know how to test it.

jvanulde commented 3 years ago

Still seems to be an issue. Can be tested by looking at the queryables for a collection. For example:

https://geo-api.dev.riskprofiler.ca/openapi?f=html#/dsra_acm6p5_beaufort_all_indicators_b/getDsra_acm6p5_beaufort_all_indicators_bQueryables

You will notice the following errors:

Screen Shot 2021-03-11 at 4 17 20 PM
arashmalekz commented 3 years ago

I set the ogc_schemas_location path to where the files are located in Lambda which is "/var/task/schemas.opengis.net " However, it's still sending a request to "http://schemas.opengis.net" website. Is that how it's supposed to work or it should send the request to geo-api.dev.riskprofiler.ca for getting the ogc features?

jvanulde commented 3 years ago

It should send the request to geo-api.dev.riskprofiler.ca. Not sure what's happening. Let me try a local build to see if I get the same result.

jvanulde commented 3 years ago

This works: https://github.com/OpenDRR/pygeoapi/blob/1e6878aa064dc4420913ec9a7fc268990e373a22/pygeoapi-config.yml#L51

arashmalekz commented 3 years ago

In your case, do you see it sending the request to your localhost instead of "http://schemas.opengis.net"? No matter what I try, it's always sending the request to that website. I know it's pygeoapi that's deployed in lambda is seeing the files that exist in /var/task/schemas.opengis.net, because if I change that path, it throws an error saying ogc is misconfigured.

arashmalekz commented 3 years ago

I figured what the issue is. The generated openapi.yml file actually contains the URL to the OGC schemas. Those URLs are generated differently depending on whether you have set the parameter for ogc_schemas_location or not. When the openapi.yml file was generated originally, the ogc_schemas_location wasn't set, so the URLs were set to http://schemas.opengis.net I regenerated the openapi.yml and it's good now.

jvanulde commented 3 years ago

Nice find @arashmalekz. Working great now.