plugin middleware
StackResource rewritten