Middleware for a dynamic SITE_ID added.
Merged with master.