We are building an application which uses SailsJS for backend and ExtJS for frontend. ExtJS automaitcally appends these parameters to every AJAX request coming from its grid: _dc=1421519546371&page=1&start=0&limit=25
I need to remove these parameters on the Sails side before they are passed to the blueprint actions, so that I can take advantage of the blueprint REST API. Where would be the best place to remove these parameters? I can think of my NGINX reverse proxy as one option, but I am sure there is a better place within Sails.
In sails the easiest place would be to remove them with a policy.
RemoveParams.js
module.exports = function(req, res, next) {
if(req.query._dc) delete req.query._dc
// ect ....
next();
};
Alternate method using undocumented req.options. I have not used this, but it would seem to work and was recommended in the comments.
module.exports = function(req, res, next) {
req.options.values.blacklist = ['_dc']
// or req.options.values.blacklist.push('_dc') ??
next();
};
If you so choose you could also add your own middleware to replace / remove them as well.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.