Too much overlap in storage plugin URLs for meaningful loadbalancing and config simplicity. Make poorxy emulate the real situation and change related URLs.

This commit is contained in:
Simo Kinnunen
2015-01-07 14:04:36 +09:00
parent 7c16c40dae
commit 8b9e5d58c9
8 changed files with 70 additions and 57 deletions

View File

@@ -1,4 +1,5 @@
var http = require('http')
var util = require('util')
var express = require('express')
@@ -20,9 +21,14 @@ module.exports = function(options) {
app.set('trust proxy', true)
app.get(
'/s/api/v1/image/:id/*/transform'
'/s/image/:id/:name'
, requtil.limit(options.concurrency, function(req, res) {
return get(req.url, options)
var orig = util.format(
'/s/blob/%s/%s'
, req.params.id
, req.params.name
)
return get(orig, options)
.then(function(stream) {
return transform(stream, {
crop: parseCrop(req.query.crop)