Using the MantisBT REST API when hosted on IIS

open source projects

I am presently within the strategy of shifting our internet hosting providers from one supplier to a different; though some elements of cyotek.com infrastructure runs on Microsoft Azure, a good chunk makes use of extra conventional internet hosting. Our MantisBT occasion is one such service that I not too long ago migrated.

Beforehand the occasion was hosted on Linux, now it is on Home windows. The preliminary migration appeared to have gone nicely and so I might moved onto the following sub-domain on the listing.

This morning nevertheless I observed the error logs had been itemizing that cyotek.com wasn’t capable of show product street maps. On testing, I used to be getting 404 responses for any calls to the REST API on the migrated MantisBT occasion.

Apache Redirects

The REST API in MantisBT makes use of Apache’s mod_rewrite module to rewrite any URI to /api/relaxation/ to /api/relaxation/index.php utilizing the next guidelines in .htaccess

In fact, IIS would not assist .htaccess information and so these rewrites by no means happen, therefore the 404.

Redirecting in IIS

IIS has its personal model of mod_rewrite, the URL Rewrite module, though it is not put in by default. You’ll find the best way to set up this module in a previous post.

As soon as put in, you may add rewrite guidelines to internet.config both by way of the IIS Supervisor GUI, or by instantly enhancing the configuration – this submit will cowl each approaches.

Importing .htaccess guidelines

I briefly spoke about manually modifying internet.config so as to add rewrite guidelines in our submit on Redirecting to HTTPS when using IIS behind a load balancer. This time I’ll describe the best way to import the rewrite guidelines of a .htaccess file instantly into IIS.

  • Firstly, open IIS supervisor after which navigate to the api/relaxation folder of your MantisBT set up
  • Subsequent open the URL Rewrite part.
  • Click on the Import Guidelines… choice within the Actions sidebar.
  • Within the Configuration file discipline, choose the .htaccess file situated within the native api/relaxation folder after which click on Import.
  • Confirm that the Rewrite guidelines discipline shows the suitable redirect and that Transformed Guidelines signifies that the rule was efficiently imported.Importing .htaccess rules into IIS
  • Within the Actions sidebar, click on Apply to save lots of the modifications, then click on Again to Guidelines to return to to the primary URL Rewrite part itemizing the imported rule. The imported configuration

That needs to be all that’s required; the REST API calls ought to now rewrite and succeed. To rapidly take a look at that each one is nicely, open up http://yourinstantURL/api/relaxation/tasks/ in your browser – when you get a 401 error, then the redirect is working appropriately.

Manually updating the configuration

In case your occasion is hosted remotely you won’t have direct entry to IIS Supervisor or be capable of remotely connect with it. Under is the entire internet.config file used to allow redirects, merely copy it to the /api/relaxation folder of your MantisBT occasion.

cyotek.com Summary RSS

Leave A Reply

Your email address will not be published.