Comments (2)
That would something that you put in a filter so that when LAZO.app.navigate
is called you can redirect to another page.
from lazo.
here is the solution. you can do something like to only allow redirect within current site
LAZO.app.addRequestFilter('.*', function (path, params, ctx, options) {
var hostname = ctx.location.hostname;
var port = ctx.location.port;
var sslPort = LAZO.config.get('sslPort') || 8443;
var sslProtocol = LAZO.config.get('sslProtocol') || 'https';
var hostMatchPattern;
var redirectHost;
var redirectUrl;
hostMatchPattern = port ? hostname + ':' + port : hostname;
redirectHost = getHostName(ctx.params.redirect);
if (!(redirectHost === hostMatchPattern)) {
//redirect to main host page
return options.success(sslProtocol + '://' + hostname + (sslPort ? ':' + sslPort : ''));
}
});
function getHostName(url) {
var regex = /^(?:https?:\/\/)?(?:www\.)?([^\/]+)/i;
var redirectHostMatch = url.match(regex);
var redirectHost;
if (redirectHostMatch) {
redirectHost = redirectHostMatch[1];
}
return redirectHost;
}
from lazo.
Related Issues (20)
- Directory Content Listing HOT 2
- Url encoding bug?
- Clickjacking Defense support in lazo
- LAZO.app.addRequestFilter can this be called multiple times?
- where is the best place to config httpOnly and secure cookie? HOT 4
- node-htmlparser adds a `exports` property to window which conflicts with amd definitions in Lazo V2 HOT 1
- another install issue HOT 1
- Client has hard coded error template params HOT 1
- `viewDefinitions` doesn't accept objects, just paths.
- LAZO.app.navigate doesn't call the controller upon query parameter change
- Bug: Context has undefined _reply property
- collectionView dynamic collection assignment HOT 4
- Client side collection binding bug
- Controller Serialization HOT 2
- Structured Logging HOT 1
- Standardize Sync/Call http responses
- appending requirejs paths
- Support ServiceProxy to send body in Delete Rquest HOT 1
- Is this alive? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lazo.