Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLPI 9.4.3 and app for Grafana 1.3.0 #53

Open
menemat opened this issue Nov 22, 2019 · 8 comments
Open

GLPI 9.4.3 and app for Grafana 1.3.0 #53

menemat opened this issue Nov 22, 2019 · 8 comments

Comments

@menemat
Copy link

menemat commented Nov 22, 2019

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.

@ddurieux
Copy link
Owner

You put this lines into or into ?

@menemat
Copy link
Author

menemat commented Nov 25, 2019

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"

but I got always the same error

@menemat
Copy link
Author

menemat commented Nov 26, 2019

/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,$

....

a2enmod headers -> Module headers already enabled
systemctl restart apache2

glpiAPI glpigrafana glpi-TOKENgrafana glpi-TOKENuser

@ddurieux
Copy link
Owner

On grafana when you test, check the developper console (F12) to see the real error on HTTP requests

@menemat
Copy link
Author

menemat commented Nov 26, 2019

Thanks for the fast answer!

glpi-CORSerror

@ddurieux
Copy link
Owner

Ok so it's confirmed, it's CORS problem.
The error say you use https (443) but in your apache config you have so I think you don't have put the CORS configuration in the right VirtualHost/Directory

@menemat
Copy link
Author

menemat commented Nov 26, 2019

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?

@ddurieux
Copy link
Owner

I don't know, depend of the package of Apache2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants