-
-
Notifications
You must be signed in to change notification settings - Fork 9
FAQ
Frequently Asked Questions
Since v1.4.0 it is possible to place your ProcessWire instance in a subdirectory (like „/backend“) and use it as a headless CMS for e.g. a Javascript-application which is placed in the root.
AppApi has a configuration option to remove the ProcessWire root (subdirectory path) from all links, which could be handy for the mentioned Javascript-application placed in the root directory. The application can organize routing by itself and pass the current route to the ProcessWire backend, which returns the page’s data.
When the option is activated, all page links generated by AppApi::getAjaxOf() will be returned without the ProcessWire root. For your custom output you can use the helper functions AppApi::getUrlRelativeToRoot($url), AppApi:: getHttpUrlRelativeToRoot($httpUrl) and AppApi:: replaceRootLinksInText($text) to replace your link urls.
In some cases the server config does block Authentication Headers by default. Try adding the following line to your .htaccess file:
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
In other cases it helped to add the following line:
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
If you want to include an image from the api using the standard <img src=""> tag, it can be very difficult to include the api key and a token as headers. However, it is possible to include these values as GET parameters. The GET parameter with the apikey is called api_key. A token can be sent as parameter authorization.
Disclaimer: I recommend to use this solution only for this exceptional case. Generally headers are the better and more elegant solution.
Please check if ProcessWires urlSegments feature is enabled for your homepage. It must be turned off so that the api url can correctly be sent to the AppApi module.
AppApi
Connect your apps to ProcessWire!
| ProcessWire-Module: | https://modules.processwire.com/modules/app-api/ |
| Support-Forum: | https://processwire.com/talk/topic/24014-new-module-appapi/ |
| Repository: | https://github.com/Sebiworld/AppApi |
| Wiki: | https://github.com/Sebiworld/AppApi/wiki |