You are not logged in.
Pages: 1
Hi,
Why I can't call the initSession?
Explanation:
.../apirest.php ==> leads to documentation
request:
$ curl -X GET \
-H 'Content-Type: application/json' \
-H "Authorization: user_token xxx" \
-H "App-Token: xxx" \
.../apirest.php/initSession
result
404 Not Found
nginx/1.4.6 (Ubuntu)
on GLPI
URL of the API: localhost/api
Enable Rest API: Yes
API client has been added
What is missing? Please help how to make this work.
running of these specs:
version GLPI 9.1.1
server: nginx/1.4.6 (Ubuntu)
PHP/5.5.9-1ubuntu4.26
the config:
server {
listen 8001;
listen [::]:80;
root /home/locadirectory;
index index.php index.html index.htm index.nginx-debian.html;
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
# Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
#location /RequestDenied {
# proxy_pass 127.0.0.1:8080;
#}
error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location /api {
rewrite ^/api/(.*)$ /apirest.php/$1 last;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
PhDev
Offline
Hi,
I went through this issue and find the culprit so even if too late for you an other one mught find the answer usefull.
The issue is on the location line
location ~ \.php$ {
It only match url ending by .php and not url in apirest.php/whatever
To make it work you can change the line to
location ~ \.php {
if you raise into other issues you can probably enhance the regexp for matching \.php($|\/) but I didn't check if escaping was necessary
Offline
Pages: 1