Tạo liên kết chia sẻ lên social
This commit is contained in:
@@ -5,6 +5,14 @@ const { URL } = require('url');
|
||||
* from the official app domain (SYSTEM_HOST). Blocks direct URL access.
|
||||
*/
|
||||
const verifyReferer = (req, res, next) => {
|
||||
// Cho phép các Bot của mạng xã hội truy cập để lấy ảnh thumbnail
|
||||
const userAgent = req.headers['user-agent'] || '';
|
||||
const isSocialBot = /facebookexternalhit|Facebot|ZaloBot|Twitterbot|Slackbot|LinkedInBot|Embedly/i.test(userAgent);
|
||||
|
||||
if (isSocialBot) {
|
||||
return next();
|
||||
}
|
||||
|
||||
const referer = req.headers.referer;
|
||||
const origin = req.headers.origin;
|
||||
const systemHost = process.env.SYSTEM_HOST || 'http://localhost:5000';
|
||||
|
||||
Reference in New Issue
Block a user