Hi all,
I have a project with the print tool correctly set, I’m able to print all my overlay layers but OSM as baselayer is not printed. If I try to make a wget request to a tile (eg. wget https://tile.openstreetmap.org/11/1078/740.png) I got a 403 forbidden error. Specifing the same user-agent of the getprint request from lizmap (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36), I got a 418 BLOCKED. If I modify the user-agent (eg. removing the Safari/537.36) I got 200 OK.
wget --debug https://tile.openstreetmap.org/11/1078/740.png --> 403 forbidden
wget --debug --user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36" https://tile.openstreetmap.org/11/1078/740.png --> 418 BLOCKED
wget --debug --user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159" https://tile.openstreetmap.org/11/1078/740.png --> 200 ok
The print tool works percfectly in other projects on a different server even if the get print request has the same user-agent and without any modification.
Do you have the option “Get images directly from WMS Server” set in your Lizmap QGIS Plugin for the OSM layer? I have not, and i can print OSM just fine!
There have already been similar problems with WMS services due to the missing .cache directory.
This must be defined in a variable for the QGIS server (under Apache). And the directory must be writable for www-data.
and the variable for the QGIS server is also set accordingly?
FcgidInitialEnv QGIS_SERVER_CACHE_DIRECTORY /home/qgis/.cache
(/home/qgis/.cache as an example for me)
Can you check this file ?
You must find it, is-it in ~/.local/share/QGIS/QGIS3/profiles/default/, QGIS Server (same as desktop) is creating its own profile folder with all data inside.
Where is-it located ? Does it have enough rights to be written now (by QGIS-Server) ? What is the last update date of this file ? Can you try to move it to see if the file is there again ?
Thank you for the hint, the qgis-auth.db file got the proper rights but the folder didn’t. I gave the write permissions to the folder and now OSM layer is correctly printed!