Mantis api not working on Nginx server. Please help

Get help from other users here.

Moderators: Developer, Contributor

Netclues
Posts: 5
Joined: 01 Mar 2023, 11:17

Mantis api not working on Nginx server. Please help

Post 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.
Attachments
mantis_api_not_working.png
mantis_api_not_working.png (49.17 KiB) Viewed 1881 times
Netclues
Posts: 5
Joined: 01 Mar 2023, 11:17

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

Post by Netclues »

Hello Mantis Team,

Any Update on this ?
cas
Posts: 1462
Joined: 11 Mar 2006, 16:08
Contact:

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

Post by cas »

This is not related to Mantis but to postman, suggest you check with them about the different behavior between Apache and Nginx.
atrol
Site Admin
Posts: 8243
Joined: 26 Mar 2008, 21:37
Location: Germany

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

Post 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.
Please use Search before posting and read the Manual
Netclues
Posts: 5
Joined: 01 Mar 2023, 11:17

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

Post 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.
atrol
Site Admin
Posts: 8243
Joined: 26 Mar 2008, 21:37
Location: Germany

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

Post 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?
Please use Search before posting and read the Manual
Netclues
Posts: 5
Joined: 01 Mar 2023, 11:17

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

Post 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.
Attachments
Screenshot (530).png
Screenshot (530).png (165.33 KiB) Viewed 1757 times
atrol
Site Admin
Posts: 8243
Joined: 26 Mar 2008, 21:37
Location: Germany

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

Post 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?
Please use Search before posting and read the Manual
Netclues
Posts: 5
Joined: 01 Mar 2023, 11:17

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

Post 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 ???
acchaudhary
Posts: 3
Joined: 13 Mar 2023, 12:48

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

Post 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 ???
acchaudhary
Posts: 3
Joined: 13 Mar 2023, 12:48

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

Post 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.
atrol
Site Admin
Posts: 8243
Joined: 26 Mar 2008, 21:37
Location: Germany

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

Post 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
Please use Search before posting and read the Manual
acchaudhary
Posts: 3
Joined: 13 Mar 2023, 12:48

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

Post 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: ?
cas
Posts: 1462
Joined: 11 Mar 2006, 16:08
Contact:

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

Post by cas »

Please first answer the questions raised if you want to have proper support.
atrol
Site Admin
Posts: 8243
Joined: 26 Mar 2008, 21:37
Location: Germany

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

Post by atrol »

As told before, I am not using Nginx, but this might help https://www.slimframework.com/docs/v3/s ... rvers.html
Please use Search before posting and read the Manual
Post Reply