当我在本地启动我的Angular ionic应用程序并刷新页面(所有页面)时,我会看到这些控制台日志。
但是,当我在生产环境中将其部署到PM2上时,我的控制台日志只出现在主页上。
我想动态设置OG Meta标签为Facebook的内部网页以及。
localhost enter image description here
prod enter image description here下面是来自server.ts文件的代码片段
const proxyConfig = environment.production ?
require('./proxy.conf-prod.json') :
require('./proxy.conf-dev.json');
console.log(proxyConfig)
export function app(): express.Express {
const app = express();
const distFolder = join(process.cwd(), 'dist/monapp/browser');
const index = existsSync(join(distFolder, 'index.original.html')) ? 'index.original.html' : 'index';
app.engine('html', ngExpressEngine({
bootstrap: AppServerModule,
}));
const staticFolder = join(process.cwd(), 'dist/monapp/browser/assets');
app.use('/usr/share/nginx/html/dist/monapp/browser/assets', express.static(staticFolder, {
maxAge: '1y'
}));
const distFolderCustom = environment.production ? "/usr/share/nginx/html/dist/monapp/browser" : distFolder
app.set('view engine', 'html');
app.set('views', distFolderCustom);
const apiProxy = createProxyMiddleware(proxyConfig['/api']);
app.use('/api', apiProxy);
app.get('*.*', express.static(distFolder, {
maxAge: '1y'
}));
app.get('*', (req, res) => {
console.log('SSR requested for URL:', req.originalUrl);
res.render(index,
{req, providers: [{provide: APP_BASE_HREF, useValue: req.baseUrl}]},
async (err, html) => {
if (html) {
const resCheck = await checkAndAddTags(html, req.originalUrl).then();
res.send(resCheck);
} else {
res.send(html);
}
});
});
return app;
}
字符串
“我想在内部页面时查看控制台日志并刷新,是关于根据页面使用setMetadata设置checkAndAddTags的。”
1条答案
按热度按时间cpjpxq1n1#
经过一整天的研究,我刚刚意识到我的nginx conf的问题
好的会议是
字符串
不
型