Page 1 of 2

Mantis api not working on Nginx server. Please help

Posted: 01 Mar 2023, 11:44
by Netclues
Hello Dear Team,

I have change server form Apache to Nginx server. API is working before on Apache server but now after changing API is not working.

when call api in postman it's show login page.

Link: https://domain-name.com/api/rest/projects/176 but this get api or any api NOT working.

Please check attachment for more information.

Can you please help me about this QUICKLY.

Re: Mantis api not working on Nginx server. Please help

Posted: 02 Mar 2023, 05:55
by Netclues
Hello Mantis Team,

Any Update on this ?

Re: Mantis api not working on Nginx server. Please help

Posted: 02 Mar 2023, 09:26
by cas
This is not related to Mantis but to postman, suggest you check with them about the different behavior between Apache and Nginx.

Re: Mantis api not working on Nginx server. Please help

Posted: 02 Mar 2023, 09:27
by atrol
Does it work if you login in browser and enter the same URL in browser that you are using in Postman?
If yes, search for help around Nginx and Postman.

Re: Mantis api not working on Nginx server. Please help

Posted: 03 Mar 2023, 06:02
by Netclues
@cas:
This is not related to Mantis but to postman, suggest you check with them about the different behavior between Apache and Nginx.
- Hello Dear, it's related to mantis where just we are using postman to check our api nothing more on there. what is the exact issue on Nginx server or you are asking us to add rule to work fine ?

@atrol:
Does it work if you login in browser and enter the same URL in browser that you are using in Postman?
If yes, search for help around Nginx and Postman.
- Hello Dear, we have system where are using Mantis Rest API and adding Project and assign user to mantis using API but now Mantis is not working. so, i am checking them in postman to if that work or not. but my bad luck that not working and send me login page.

Just One Main Question: when we are call Mantis API call that time we need username and password to enter for get data from mantis using API Call ??
because right now i am not pass username and password but pass Authentication token that i have generated from Administrator account.
it send me to login page and api call not get any data.
i am not sure but may be that Nginx rule issue or any other mantis issue. Please suggest me to do fix and also if any Nginx server rules related issue then send me rules which one i use then it will be work fine.

Thanks for your quick help.

Re: Mantis api not working on Nginx server. Please help

Posted: 03 Mar 2023, 07:03
by atrol
What's the answer to my question
"Does it work if you login in browser and enter the same URL in browser that you are using in Postman?"
Yes or no?

Re: Mantis api not working on Nginx server. Please help

Posted: 03 Mar 2023, 14:33
by Netclues
when i login in browser and enter this url then one file download and when we open then that show below code as attached.

Re: Mantis api not working on Nginx server. Please help

Posted: 03 Mar 2023, 14:58
by atrol
So your installation shows code instead of executing it.
This might be a Nginx configuration issue, but on the other hand it looks like as if other pages are rendered in HTML and don't deliver the code.
I don't use Nginx, so if it should be Nginx related, I can't help.

Independent from that

- Which MantisBT version and which PHP version do you use?
- Did you run <YourMantisBT>/admin/check/index.php and fixed all errors and warnings you got?
- Did you check the web server and the PHP log files for errors and warnings?
- Did you change any original MantisBT file?

Re: Mantis api not working on Nginx server. Please help

Posted: 07 Mar 2023, 05:16
by Netclues
Hello Dear Mantis Team,


- Which MantisBT version and which PHP version do you use? --- Mantis Version: 2.24.1 , PHP : 7.4
- Did you run <YourMantisBT>/admin/check/index.php and fixed all errors and warnings you got? --- we are checking
- Did you check the web server and the PHP log files for errors and warnings? --- where to find this log. i have try to find a mantis log but not find anywhere.
- Did you change any original MantisBT file? --- NO

Main and very important question for me: when we call API that time we have to pass parameter username and password ?? or that work with API key only ???

Re: Mantis api not working on Nginx server. Please help

Posted: 13 Mar 2023, 12:50
by acchaudhary
Hello Team,

Any Update about it ???

*Main and very important question for me* : when we call API that time we have to pass parameter username and password ?? or that work with API key only ???

Re: Mantis api not working on Nginx server. Please help

Posted: 17 Mar 2023, 06:04
by acchaudhary
can you please let me know about this ???

*Main and very important question for me* : when we call API that time we have to pass parameter username and password ?? or that work with API key only ???

Please reply Quickly. we are waiting for your response.

Re: Mantis api not working on Nginx server. Please help

Posted: 17 Mar 2023, 08:46
by atrol
As a first step I recommend to upgrade to latest stable version (2.25.6 at the moment) as there are also REST API error handling related issues fixed in it, e. g. https://www.mantisbt.org/bugs/view.php?id=28927

> - Did you run <YourMantisBT>/admin/check/index.php and fixed all errors and warnings you got? --- we are checking

Did you check / fix?

- Did you check the web server and the PHP log files for errors and warnings? --- where to find this log. i have try to find a mantis log but not find anywhere.

Depends on your web server configuration, maybe /var/log/nginx

Re: Mantis api not working on Nginx server. Please help

Posted: 17 Mar 2023, 09:40
by acchaudhary
okay.
can you please let me know about below my question of the answer.

Q. when we call API that time we have to pass parameter username and password ?? or that work with API key only ?
Ans: ?

Re: Mantis api not working on Nginx server. Please help

Posted: 17 Mar 2023, 10:20
by cas
Please first answer the questions raised if you want to have proper support.

Re: Mantis api not working on Nginx server. Please help

Posted: 17 Mar 2023, 18:55
by atrol
As told before, I am not using Nginx, but this might help https://www.slimframework.com/docs/v3/s ... rvers.html