RESTful API PHP 302 response
Mark Strickland
smsmail at roadrunner.com
Thu Aug 30 01:41:26 CEST 2012
I have a RESTful API on my website that uses the Tonic.php frame work to
create the API. I am running Apache2 and Varnish. The web site and the API
works great, but the API returns a code 302 along with the data. It is
causing the client apps to have trouble getting the data from the API. Is
there any way to get a 200 response sent back? I though the below would
stop the 302 response, but it is not. If you need more information or want
to try the API let me know and I will send you the information.
# Do not cache these paths.
if (req.url ~ "^/status\.php$" ||
req.url ~ "^/update\.php$" ||
req.url ~ "^/admin$" ||
req.url ~ "^/admin/.*$" ||
req.url ~ "^/flag/.*$" ||
req.url ~ "^/munin/.*$" ||
req.url ~ "^.*/ajax/.*$" ||
req.url ~ "^.*/api/.*$" ||
req.url ~ "^.*/apidev/.*$" ||
req.url ~ "^.*/phpmyadmin/.*$" ||
req.url ~ "^.*/ahah/.*$") {
return (pass);
}
Here is the headers I am getting back.
HTTP/1.1 302 Found
X-Varnish-Cache:
MISS
X-Varnish:
1548785385
Age:
0
Date:
Wed, 29 Aug 2012 23:37:34 GMT
Content-Length:
27173
Allow:
PUT, GET
X-Resource:
TaskHandler
Via:
1.1 varnish
Content-Type:
application/json
Connection:
close
X-Powered-By:
PHP/5.3.2-1ubuntu4.17
Server:
Apache/2.2.14 (Ubuntu)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20120829/2263ffaf/attachment.html>
More information about the varnish-misc
mailing list