New selection statement: Method
This conditional statement evaluates to true, if the request method matches the supplied pattern, e.g.:
Service
Method "POST"
...
End
New internal backend: Success
Always returns a 200 response code. This is intended mainly for handling special requests. For example, the service definition below replies to the OPTIONS requests:
Service
Method "OPTIONS"
Rewrite response
SetHeader "Access-Control-Allow-Origin: example.com"
SetHeader "Access-Control-Allow-Methods: GET,POST,PUT"
SetHeader "Access-Control-Max-Age: 1800"
End
Success
End
Changes in Lua API
-
http.req.bodyThis field contains the captured content of the incoming request. For it to be available, content capturing must be explicitly enabled for the service on whose behalf the Lua code is called. Content capturing is enabled by the following new configuration statement:
ContentCapture SIZEwhere SIZE sets the upper limit on the captured content size. If the actual content length is greater than this value, saved material is discarded and
http.req.bodyis set to nil. -
http.req.resendLua functions invoked from
Rewrite responsecan set this variable totrueto have pound resend the modified request to backend. This can be used, for example, to handle 401 responses from the backend by inserting appropriately craftedAuthorizationheader and resubmitting the request.To avoid dead loops, pound limits the number of such resends to 4 per request.