OSTicket is one of the popular open-source Support Ticket Systems that can be hosted on your Shared-Server or VPS or Dedicated Server and that’s without paying any subscription fee. In this article, we’ve tried to provide you with a solution to some API-related bugs that are not yet patched despite several version releases.
The most common and unresolved issue is when you try to create a new ticket or a new task using the API, the system returns either “No input file specified“, “unsupported input file specified” or “URL not supported“. It is basically
.htaccess rewrite issues and also some bugs within the OSTicket System itself and your web server be it IIS or Apache.
No input file specified
“No input file specified” is a
.htaccess rewrite issue and there are several tweaks discussed on GitHub and OSTicket community forum. Certainly, no doubt some of those tweaks may work for person A, and on other hand, it may not work for person B. Personally, we’ll not suggest making any changes in
.htaccess and recommends using an alternative method to resolve the No input file specified issue. You can directly specify the API URL while calling using cURL or any other method; for instance, if you’ve hosted OSTicket at
https://support.example.com then you can simply specify
https://support.example.com/api/http.php/tickets.json instead of
https://support.example.com/api/tickets.json and the same is applicable for
On the other hand, if you want to correct the
.htaccess rewrite rule, then you can change from
RewriteRule ^(.*)$ %1/http.php/$1 [L] to RewriteRule
^(.*)$ %1/http.php?$1 [L].
OSTicket (Running Offline or on localhost)
If you’ve installed the OSTicket on your local machine, then please make sure to generate the OSTicket API Key for localhost (IP address). In some cases, even after specifying the localhost IP address does not work, in that case, you can try another API Key with
::1 IP address. Also, make sure to follow the instruction aforementioned, and checking the OSTicket System log seems to be helpful.
Cloudflare or CDN
Foremost, if you are using Cloudflare or any other CDN service, then you should whitelist your server’s IP address in your Cloudflare or CDN account. Make sure to whitelist both IPv4 and IPv6 to avoid getting blocked at your CDN level. Other things that you’d to ensure:–
- Foremost whitelist Your IPv4 and IPv6 at your CDN provider’s end or disable proxy for a specific sub-domain or domain.
- Generate OSTicket API Key with the exact IP of your server. If you are not able to find the server’s IP you can the DNS record of your hosting provider in cPanel or the DNS manager option offered by your hosting provider.
- While testing we’ve found very strange with several hosting providers like BlueHost, DreamHost, Google Cloud, and AWS VPS that sometimes, API request comes from IPv6 instead of IPv4 despite having IPv4 in that case you can check the OTSTicket System log which will show the exact IP address from which you are making the request.
cURL Forced Resolve to specific IP Address
"--resolve" option to stick to a specific IP address and port number. You can utilise this functionality to bypass the proxy and also to force to resolve the hostname against the specified IP address. This can be done by initializing
$ch = curl_init('192.168.1.1'); and adding Host to the
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Host: support.example.com', 'Expect:', 'X-API-Key: YOUR-API-KEY'));
Note:– Don’t forget to replace 192.168.1.1 with your Server’s IP, support.example.com with your OSTicket’s hosted sub-domain or domain, and YOUR-API-KEY with your OSTicket’s Key.
Handling File attachments properly
You should be very careful if you are using attachments and make sure that you are generating a valid base64 code with the proper header. In PHP
data:file_mime;base64, string from the base64 code, that you’ve to handle at your end. You can use the following PHP code to concatenate a valid base64 with the proper MIME header code —
$filetype=$_FILES["fileToUpload"]["type"]; // replace fileToUpload with your input file's name $base64_doc='data:'.$filetype.';base64,'; $base64_doc.=base64_encode(file_get_contents(getcwd().'/'.$target_dir.$filename));
You can contact us if need any help or have any suggestions regarding the same.