Any and all help is appreciated. osTicket is a php based ticketing system. I have successfully installed the application and all is well except for the creation of tickets via email. The use a cron script to poll a pop server. I am using the scheduled task feature to hit a php script called rcron.php which in turn posts to their api that then calls the polling mechanism. I can't get this to work. There is a url rewrite which is required. I have imported the php script for apache but still I get the following error: HTTP/1.1 400 Bad Request Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Content-Length: 17 Content-Type: text/html; charset=UTF-8 Expires: Thu, 19 Nov 1981 08:52:00 GMT Server: Microsoft-IIS/7.5 Set-Cookie: PHPSESSID=1t2r8nn3d2vvh4kjbb6d4ubnr5; path=/ X-Powered-By: ASP.NET Date: Tue, 23 Jul 2013 19:10:55 GMT Connection: close URL not supported These is the php rewrite script. <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} (.*/api) RewriteRule ^(.*)$ %1/http.php/$1 [L] </IfModule> <rule name="Imported Rule 1" stopProcessing="true"> <match url="^(.*)$" ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> <add input="{URL}" pattern="(.*/api)" ignoreCase="false" /> </conditions> <action type="Rewrite" url="{C:1}/http.php/{R:1}" /> </rule>
mod_rewrite is an Apache function, it isn't going to work on a Windows server. You can use the URL Rewrite module in IIS to do that. Check out the last section of this Knowledge Base article; Accomplishing the redirect.
Thanks for the reply. I have done this already. The bottom of the post is the IIS rewrite which was generated when I imported the PHP script. I'm looking for someone who knows PHP and can tell me if the IIS rule is correctly imported.
www.demandadvantage.com/support/api/tasks/cron. the scheduler is setup to hit www.demandadvantage.com/support/api/rcron.php. I'm not a PHP guy but it looks like curl is used to post to the above URL. The reason for this from osTicket is that a post with header information is required and the scheduler only does a get. It's really hard to resolve because it don know what the expected values is by the PHP script. Its all Greek to me. I have the PHP script. Really appreciate the help.
Let me make sure i understand, the page http://www.demandadvantage.com/support/api/tasks/cron is supposed to trigger some action that pull the email from a POP server. If that's the case, how come calling this URL causes an error?
That is my question. How come it is causing an error? I don't know iis rewrite very well. I don't know php so it's hard for me to say where the problem is because I don't have the technical skill set. I really appreciate your help on the IIS rewrite. To solve this problem someone would need to know IIS and php to troubleshoot the issue. It could be an issue with osTicket. I have posted to their forums and have not gotten much back. Perhaps I am not from the right part of town being that I am attempting to host osTicket on IIS. As a back up plan I have set up osTicket on another host provider that is php. If that goes well, I'll give up and modify the CNAME for support.demandadvantage.com to point to the PHP host. Once again thanks for your help.
Documentation from osTicket on pop3 polling: http://osticket.com/wiki/Email_Settings#POP3.2FIMAP_Polling. An os support tech said the rewrite url rule was wrong provided the attached web config. I tested the rule conditions and the following backlinks were created: {R:0} www.demandadvantage.com/support/api/rcron.php {R:1} www.demandadvantage.com/support/api {R:2} rcron.php given the rewrite rule: <action type="Rewrite" url="{R:1}api/http.php/{R:2}"/> should resolve to be www.demandadvantage.com/support/api/api/http.php/rcron.php. I tried <action type="Rewrite" url="{R:1}/http.php/{R:2}"/> <action type="Rewrite" url="{R:1}http.php/{R:2}"/> both with the same result of 404 not found. This is probably better error than the 400 I was getting.
i read their doc and got an idea how this thing work. I think you didn't setup the rcron.php correctly Try change the URL in the rcron.php to http://www.demandadvantage.com/support/api/cron.php I don't think you even need to setup the urlrewrite. Just hit http://www.demandadvantage.com/support/api/rcron.php with your browser and see if it works
Their docs all say /api/tasks/cron. You can't reference cron.php directly because it is a post with header info. That is what rcron.php does. Creates a post. Why it posts to ../api/tasks/cron and not ../api/cron.php I dont know
hmmm.. that's not what i read. Here's from their doc Some hosts do not allow adding cron jobs, and instead only allow you to probe scripts located at a publicly accessible URL. In this case, you will schedule the task using your webhost's scheduling interface and http://domain/path/to/osticket/api/cron.php. have you tried it?
Yes it doesn't work. If you try it, you get an error: cron.php only supports local cron calls - use http -> api/tasks/cron. This started me down the path I am no now. See http://osticket.com/forums/showthread.php?t=14781
i think i have an idea for you 1) Create an asp.net script that spawn a process 2) Execute this command C:\php-fastcgi\php.exe E:\web\demandadvan\htdocs\support\api\cron.php 3) Use scheduled task to ping the page you created
I have no issue with you testing the app in your dev. I think that is a good idea. I saw a post saying that they solved the issue by creating an asp page that called the cron process locally. I just don't know how to do that. I appreciate your help once again.
You would do something like this System.Diagnostics.Process.Start("C:\php-fastcgi\php.exe","E:\web\demandadvan\htdocs\support\api\cron.php")
Okay we are getting a bit further along. I created a one page website in a folder called pingCron. In the code behind for the on_page event I added the above code. When this page is called by the scheduler it returns a 301 code and osTicket does not pick up the email. When I hit the url www.demandadvantage.com/pingCron from my browser it works.
Your page is returning a redirect. Our scheduler do not follow redirect. Call the aspx page directly, http://www.demandadvantage.com/pingCron/default.aspx
I understand that they need header information because they treat this call as a use of the API, but why they post that page to a non-existent URL requiring a URL rewrite is beyond me. I saw other posts saying that the way this was handled even for PHP calls has issues. Thanks again for the help.
Would you be so kind Frank tell me if osTicket supports http request? if does, pls some little example.. or how. Thank you very much Mike