add to HTTPServer middleware param of realip
This commit is contained in:
parent
df544d6580
commit
daa38cdeab
@ -235,6 +235,17 @@ module.exports = class HTTPServer extends Component {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.app.use((req, res, next) => {
|
||||||
|
req.realip = req.ip;
|
||||||
|
if (req.headers["cf-connecting-ip"])
|
||||||
|
req.realip = req.headers["cf-connecting-ip"];
|
||||||
|
|
||||||
|
req.st403 = "<h1>403: Permission denied</h1><hr/><p>Permission denied.</p>";
|
||||||
|
req.st404 = "<h1>404: Page not finded</h1><hr/><p>Please, recheck the URL address and try again.</p>";
|
||||||
|
req.st500 = "<head><title>500: Internal Server Error</title></head><body><h1>Error:</h1><hr/><p>Error catched. Check logs</p></body>";
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
this.app.use((req, res, next) => {
|
this.app.use((req, res, next) => {
|
||||||
const currentDomain = req.hostname;
|
const currentDomain = req.hostname;
|
||||||
const isNotDomained = !this.syntax.domains[currentDomain];
|
const isNotDomained = !this.syntax.domains[currentDomain];
|
||||||
@ -246,13 +257,6 @@ module.exports = class HTTPServer extends Component {
|
|||||||
authPage(this, req, res, next)
|
authPage(this, req, res, next)
|
||||||
});
|
});
|
||||||
|
|
||||||
this.app.use((req, res, next) => {
|
|
||||||
req.st403 = "<h1>403: Permission denied</h1><hr/><p>Permission denied.</p>";
|
|
||||||
req.st404 = "<h1>404: Page not finded</h1><hr/><p>Please, recheck the URL address and try again.</p>";
|
|
||||||
req.st500 = "<head><title>500: Internal Server Error</title></head><body><h1>Error:</h1><hr/><p>Error catched. Check logs</p></body>";
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
|
|
||||||
this.app.use(cookieParser());
|
this.app.use(cookieParser());
|
||||||
|
|
||||||
this.routelist.forEach(route => {
|
this.routelist.forEach(route => {
|
||||||
|
Loading…
Reference in New Issue
Block a user