creates middleware storage and throws on duplicate originCode