glpi_app_grafana
glpi_app_grafana copied to clipboard
GLPI 9.4.3 and app for Grafana 1.3.0
Hi folks,
I have tried to enable cors on a apache without success. I tried in .htaccess, in glpi.conf or 000-default.conf.
Wich is the correct marker to incapsulate
Header set Access-Control-Allow-Origin "*" Header set Access-Control-Allow-Methods "GET, POST, OPTIONS, PUT, DELETE" Header set Access-Control-Allow-Credentials true Header set Access-Control-Allow-Headers "X-Requested-With, Content-Type, Origin, Authorization, Accept, Client-Security-Token, Accept-Encoding, App-Token, Session-Token"
and in wich file?
I got this:
Access to XMLHttpRequest at 'https://glpi###############initSession' (redirected from 'http://#####/api/datasources/proxy/6/initSession') from origin 'http://#######' has been blocked by CORS policy: Request header field x-ds-authorization is not allowed by Access-Control-Allow-Headers in preflight response.
You put this lines into <VirtualHost> or into <Directory> ?
I tried: <Directory /var/www> Header set Access-Control-Allow-Origin "*" Header set Access-Control-Allow-Methods "GET, POST, OPTIONS, PUT, DELETE" Header set Access-Control-Allow-Credentials true Header set Access-Control-Allow-Headers "X-Requested-With, Content-Type, Origin, Authorization, Accept, Client-Security-Token, Accept-Encoding, App-Token, Session-Token" </Directory>
but I got always the same error
/etc/apache2/sites-enabled/glpi.conf
<VirtualHost :80> ...... <Directory /var/www/glpi> Options FollowSymLinks AllowOverride All Order allow,deny allow from all Header set Access-Control-Allow-Origin "" Header set Access-Control-Allow-Methods "GET, POST, OPTIONS, PUT, DELETE" Header set Access-Control-Allow-Credentials true Header set Access-Control-Allow-Headers "X-Requested-With, Content-Type, Origin, Authorization, Accept, Client-Security-Token,$ </Directory> .... </VirtualHost>
a2enmod headers -> Module headers already enabled systemctl restart apache2
On grafana when you test, check the developper console (F12) to see the real error on HTTP requests
Ok so it's confirmed, it's CORS problem. The error say you use https (443) but in your apache config you have <VirtualHost :80> so I think you don't have put the CORS configuration in the right VirtualHost/Directory
Thanks. I put it in glpi.conf as written above. glpi.conf is correctly linked from /sites-available Syntax is OK
Could be a problem due by 3000 port? There are differents apache config file to setup for https unlike http?
I don't know, depend of the package of Apache2




