ericferon / glpi-archimap

GLPI plugin for drawing architecture maps (based on draw.io)
GNU General Public License v2.0
19 stars 10 forks source link

Blank screen when "Drawing pane" is clicked (apache listens port 4488) #57

Closed moodyblue closed 2 years ago

moodyblue commented 2 years ago

GLPI 9.5.7 archimap 3.2.3 Apache/2.4.53 PHP 8.0.17 Firefox 98.0.2 (64-bit)

These are the errors when I press F12 image

ericferon commented 2 years ago

I encountered some problems when I made evolve the plugin to the marketplace and GLPI version 10. One of the consequences was a blank screen. From my side, it is now solved in v3.2.4. Can you check whether it solves also your problem ? K.r,

zdenkor commented 2 years ago

I have too problem with blank screen when "Drawing pane" is clicked. GLPI version 9.5.7 and Diagrams version 3.2.4.

Uncaught TypeError: Cannot read properties of undefined (reading 'value') at XMLHttpRequest.xhr.onreadystatechange (:15:365)

moodyblue commented 2 years ago

So I removed archimap from plugins folder and installed 3.2.4 from marketplace. Blank screen continues but with some variants:

1) If I specify the key name, as in the following screen image Then Firefox gives this error image 2) If I remove the key name, the Firefox error is different image

jcervantes-sipecom commented 2 years ago

Hi @zdenkor @moodyblue, I had the same issue: https://github.com/ericferon/glpi-archimap/issues/56

Could you try in the APP_TOKEN token configuration cleaning the key value?

Also as I said in my issue, you have to create an API KEY

ericferon commented 2 years ago

Please have a look to https://github.com/ericferon/glpi-archimap/wiki/How-to-install-and-set-up-the-plugin. You have indeed to specify the APP_TOKEN entry in the plugin configuration, with an empty key and a value. K.r,

moodyblue commented 2 years ago

The problem continues even after replacing the marketplace version by the plugins version image

jcervantes-sipecom commented 2 years ago

Hi @moodyblue, It could be maybe something in your apache server, can you confirm that in any *.conf in /etc/apache2/sites-enabled/ (if it's Ubuntu) don't you have something like this:

<IfModule mod_headers.c>
        Header set Content-Security-Policy "script-src 'strict-dynamic' 'nonce-rAnd0m123' 'unsafe-inline' http: https:; frame-ancestors; 'self';object-src 'none';base-uri 'none'; require-trusted-types-for 'script';"
       Header set X-XSS-Protection "1; mode=block"
--->       Header always append X-Frame-Options SAMEORIGIN
       Header set X-Content-Type-Options nosniff
       Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains"
</IfModule>
moodyblue commented 2 years ago

Thanks. I've gone through all .conf files, some of them load module mod_headers.so. but there is no IfModule making any reference to mod_headers

ericferon commented 2 years ago

The problem is linked with CORS (the Archimap plugin is using the REST API of GLPI for some operations). Personally, I added these lines to the conf file, to enable CORS :
Header always set Access-Control-Allow-Origin "*"

on the above line, you could be more restrictive and replace * by the url of your GLPI site

    Header always set Access-Control-Allow-Methods "GET, POST, OPTIONS, PUT, DELETE"
    Header always set Access-Control-Allow-Credentials "true"
    Header always set Access-Control-Allow-Headers "X-Requested-With, Content-Type, Origin, Authorization, Accept, Client-Security-Token, Accept-Encoding, App-Token, Session-Token"

and I haven't any line mentioned by jcervantes-sipecom (with or without if) Header always append X-Frame-Options SAMEORIGIN K.r,

moodyblue commented 2 years ago

Thanks. I will try to enable CORS. It's a non-trivial setup, my server is a QNAP NAS running a proprietary firmware called QTS (based on Linux kernel 5.10.60). There are several Apache versions ported to this platform, I need to test which one supports CORS.

moodyblue commented 2 years ago

Maybe the cause is different. My gpli runs in port 4488 and apirest is http://192.168.130.210:4488/GLPI80/apirest.php/

In previous error messages looks like archimap is trying to use port 80 instead

ericferon commented 2 years ago

Indeed, if you use another port, this is not included in the URL calling apirest. I added it (v3.2.5). K.r,

moodyblue commented 2 years ago

v3.2.5 puts the port incorrectly http://192.168.130.210/GLPI80:4488/apirest.php/initSession/

It should be http://192.168.130.210:4488/GLPI80/apirest.php/initSession/

Edit: I've tried with apache listening to port 80 and it works. But I would prefer to use port 4488 instead

ericferon commented 2 years ago

Yes, the port was misplaced. Solved (I hope) with v3.2.6. K.r,

moodyblue commented 2 years ago

Solved with v3.2.6. Thank you very much.