Closed AsgerPetersen closed 3 years ago
Hi
Thanks, I don't see any problem to acces the landing page from py-qgis-server.
Some thoughts about the implementation
/ows/
as are the other accesses to the qgis-server apis.Another thought: py-qgis-server may use dynamic projects and alias urls to map different types of project/layers sources. The landing page as won't be able to locate/see these sources (especially if they are dynamic sources).
Maybe the conclusion is that the built in QGIS landing page is a bad fit for py-qgis-server? Especially seeing that it wont work with dynamic sources.
It would be cool if I could write my own handler as some sort of plugin and it could generate a html response based on all projects that are served by the instance.
It may good enough to enable it: it will fit the use cases most of the time: at least all use cases covered by the vanilla qgis-server.
It would be cool if I could write my own handler as some sort of plugin and it could generate a html response based on all projects that are served by the instance.
This will work only if your projects are known when running the catalog, but that will not be the case every-time (think at a project built at run-time from some input parameters: this is the case when using py-qgis-server with py-qgis-wps)
You always have the possibility (and I recommand to do it that way) to write a qgis server plugin that implements a service api (this is in facts how the landing_page works): py-qgis-server will have - very soon - the possibility to expose services endpoints and your plugin will also work with the vanilla qgis server.
After some testing, it seems that the here is inconsistency on how url are handled:
setting /catalog
as landing page you may reach the uri /catalog/index.html
(`/catalog/ retourne an invalid unterminated response) .
If you attempt to get the metadata of a layer you get an uri like /project/<some_id>/.....
: this makes the link unusuable in the context of a proxified url - which is the case in py-qgis-server.
If I set QGIS_SERVER_LANDING_PAGE_PREFIX=/catalog
QGIS seems to prefix all paths correctly like /catalog/project/<some_id>/...
. I do not see anything not working as expected. I am using QGIS 3.20. Could the behaviour you see be related to this issue comment https://github.com/qgis/QGIS/pull/43104#issuecomment-833820364
And yes, it seems that qgis landing page requires index.html
. A better implementation than mine would probably rewrite or redirect from /catalog
to /catalog/index.html
:-)
I have tested again and I confirm that trying to open an url from the landing_page -> metadata -> services -> WMS Get Capabilities or WFS getcapabilites leads to an url /project/some_id/
not prefixed by the landing page prefix.
Aaah sorry! Now I see it too! That is clearly a bug.
And I see you reported it already at https://github.com/qgis/QGIS/issues/41354 👍
Thank you for looking into this proposal!
~It seems that there is a regression with 3.16.8, the landing page access with QGIS_SERVER_LANDING_PAGE_PREFIX does not work anymore.~
erratum: QGIS_SERVER_LANDING_PAGE_PREFIX is only available from 3.20
Landing page is available from cbe457e421109eeb60559dd9a8adfd04f6702477 Documentation has been added on how to enable and configuration. This comes with the configuration settings for exposing qgis api on public interface.
Wow, thank you so much! I have tried it out and works perfectly. Thanks again!
Fixed documentation.
@AsgerPetersen
The commit 07f996e04e3431f1433185b5e2f1704060536a96 fix the problem related of the requirement of index.html
: see https://github.com/qgis/QGIS/issues/41354#issuecomment-880528960
That is, the response is now the default json response from the landing page api: if you want the html alternate response you need to explicetely pass the index.html
in the url path.
@dmarteau thank you! (Sorry for the late response. I have been on vacation)
The QGIS server "landing page" concept is very handy in a number of cases. Having a built-in client makes it so much easier to check out simple stuff like "what projects are available", "which project file is it that has the green layer" and so on.
I made a very simple poc of enabling "landing page" in py-qgis-server here: https://github.com/AsgerPetersen/py-qgis-server/commit/165695499914399d5e8699dc4dcbfd0579c8255d
Setting
QGSRV_LANDING_PAGE=yes
,QGIS_SERVER_LANDING_PAGE_PREFIX=/catalog
andQGIS_SERVER_LANDING_PAGE_PROJECTS_DIRECTORIES=project_dir
enables the landing page athttp://host/catalog/index.html
.Before I throw more time into making it a mergeable PR I would like to ask if you are you at all interested in having this option? It is probably not something that should be enabled for production, but I think it is handy for development / testing purposes.