-
Notifications
You must be signed in to change notification settings - Fork 15
ConfigurationPipeline
Michael VERGOZ edited this page Jun 23, 2014
·
3 revisions
gate.js introduces a sweet feature use to operate on requests and responses. It has been designed to feet every case of proxy interception programming problems. A gate.js pipeline is composed of opcodes (operation codes) which are used to handle the interception.
For example the proxy retransmission to the source service are handled by an opcode proxyPass and it is generally set at the end of the pipeline. Another example would be the cache opcode which records responses and restore from disk when it possible. In the case of cache HIT, the opcode proxyPass will not be executed because cache stops the pipeline flow.
- All requests has it owns pipeline context ;
- Every opcode could stop and hook the response completely ;
- An opcode that need to retrieve informations remotely could stop the pipeline execution for a moment while it get remote informations ;
- A pipeline works with forward and reverse proxy, on reverse proxy you have one pipeline per website and in forward proxy you have one pipeline for all websites
The HTTP forward & reverse proxy has it owns operation codes.
var serverConfig = function(bs) { return({
// [...]
pipeline: {
myPipe: [
['cache'],
['acn'],
['proxyPass']
],
}
})};
Here is a explanation of the pipeline flow :
- the request pass into the cache engine, if it has data on disk it will send the response directly to the user and the pipe flow is stopped
- the cache is probably feeding but doesn't have data to restore so the pipe will ask ACN (associative cache network) to probably retrieve data from a cluster
- cache & ACN hasn't be able to send data to the user, then the request is send back to the source server