Jump to content
You are viewing a curated collection of the most significant posts in this topic.

Featured Replies

Posted

Anyone got the rewrite rule for nginx?

 

For apache etc:
 

<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /api/
RewriteRule .* index.php [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
</IfModule>

 

That was my first question in my mind after the upgrade. It's a good idea an information message in ACP with NGiNX rewrite rules when .htaccess Apache's needs update.

I just added:

location /forums/api {
	try_files	$uri $uri/ /forums/api/index.php;
}

 

Now it just seems the API is broken, the key is correctly passed to the script (even checked by echoing the $rawApiKey variable), it just throws an exception:

curl http://localhost/forums/api/core/hello --user test: 
{                                                                                                                     
    "errorCode": "3S290\/7",                                                                                          
    "errorMessage": "INVALID_API_KEY"                                                                                 
}    

curl http://localhost/forums/api/core/hello              
{                                                                                                                     
    "errorCode": "2S290\/6",                                                                                          
    "errorMessage": "NO_API_KEY"                                                                                      
}                                                                                                                     

 

Edited by Sly_Ripper

location /api/ {
        rewrite ^/api/(.*)$ /api/index.php;
}

Seems to be working (adjust for your directory structure as needed).

I used the sample script here:

 

Which outputs as expected (replaced name and url):

php testapi.php 
{
    "communityName": "name",
    "communityUrl": "url",
    "ipsVersion": "4.1.6"
}

 

 

location /api/ {
        rewrite ^/api/(.*)$ /api/index.php;
}

Seems to be working (adjust for your directory structure as needed).

I used the sample script here:

 

Which outputs as expected (replaced name and url):


php testapi.php 
{
    "communityName": "name",
    "communityUrl": "url",
    "ipsVersion": "4.1.6"
}

 

Strange, I'm still getting "INVALID_API_KEY".

I'm experiencing the same issue, it won't go past the testing page. Using plesk 12.5 with nginx proxy.

As far I understand its using proxy. However switching to apache won't make it work either. /le sigh

Yeah I'm surprised they haven't added NGINX support. I bet a large chunk of their customers use NGINX yet they're still stuck on Apache for some odd reason. @Ahmad E. the issue really isn't getting things to work with NGINX as anyone that is semi-competent can make it happen. The problem is when you open a support ticket with Invision Power and they use the fact that you have NGINX as a reason not to provide you with proper support. I had issues before where the imageproxy key needed a new hash because I changed my subdomain URL around and when I opened a ticket (this is before I knew about the hashgenerator.php), they shot me down because they claimed they don't support PHP 7 or NGINX. Yet my issue had nothing to do with either of those and I was left to figure it out on my own.

Edited by Brian K.

  • 5 years later...
 

You don't need the file when using NGINX.

I'm experiencing the same problem when on my test install. On my production server it works as expected and I'm pretty much using the same config except that the test install uses a auth_basic on the whole site... (this could be the issue!)

The following is the path that IPS is trying to access according to the NGINX logs. The post here says that it is invalid https://community.invisionpower.com/4guides/developing-plugins-and-applications/rest-api/sending-your-first-request-r167/

/api/index.php?/core/hello

The config I use is the one that @prupdated mentioned above, IE

location /api/ {
  rewrite ^/api/(.*)$ /api/index.php;
}

For me I had to do:

location ~/api/ {
  rewrite ^/api/(.*)$ /api/index.php;
}

 

Thank you for the solution !

Recently Browsing 0

  • No registered users viewing this page.