Hello everyone,
I've started playing with Lua scripting and would like to ask If anyone knows about a
way to drop or close user request on the prerequest context.
I would like to block creating buckets with dots in the name, but the use-case could be
blocking certain operations, etc.
I was able to come up with some like this
if string.find(Request.HTTP.URI, '%.') then
Request.Response.HTTPStatusCode = 400
Request.Response.HTTPStatus = "InvalidBucketName"
Request.Response.Message = "Dots are not allowed."
end
This works fine, but the bucket is created which is something that I don't want to do.
As a dirty workaround, I've thought about changing the bucket name here to an already
existing bucket, but the Request.Bucket.Name = "taken" doesn't seem to work
as the log gives me an error "attempt to index a nil value (field
'Bucket')".
Any help is much appreciated.
Show replies by date