[英]How to make the url of links on Screens in Moqui to be relative rather than absolute?
JavaScript和CSS文件的鏈接似乎具有絕對網址,例如:
<script type="text/javascript" src="http://test.dp.com:8080/js/jquery-1.9.1.min.js" language="javascript">
<script type="text/javascript" src="http://test.dp.com:8080/js/bootstrap.min.js" language="javascript">
<script type="text/javascript" src="http://test.dp.com:8080/js/holder.js" language="javascript">
<link type="text/css" href="css/bootstrap.css" rel="stylesheet">
但我希望他們是:
<script type="text/javascript" src="js/jquery-1.9.1.min.js" language="javascript">
<script type="text/javascript" src="js/bootstrap.min.js" language="javascript">
<script type="text/javascript" src="holder.js" language="javascript">
<link type="text/css" href="css/bootstrap.css" rel="stylesheet">
它也類似於屏幕上的鏈接。
我希望它們是相對的,然后可以在應用程序前面添加反向代理。
這些來自webroot組件中的Header.html.ftl文件,並使用如下值:
${sri.buildUrl(scriptLocation).url}
像這樣生成的許多URL都有完整的URL,包括主機名等。 如果不在本地運行,則幾乎總是需要在Moqui Conf XML文件中設置外部主機名和端口。 例如:
<webapp-list>
<webapp name="webroot" http-host="www.mydomain.com" http-port="80" https-enabled="false">
<root-screen host=".*" location="component://webroot/screen/webroot.xml"/>
</webapp>
</webapp-list>
請注意,這仍然具有https-enabled =“ false”。 如果將其設置為true,則還要設置@ https-host和@ https-post屬性。
請注意,如果您將http-host,http-port,https-host或https-port中的任何一個保留為空,則它們將默認為HTTP請求上的主機名和端口。 這是用於多租戶或多根屏幕設置的虛擬主機處理它的方法。 為此,必須設置任何負載平衡器或其他代理(例如httpd上的mod-proxy)以通過此HTTP請求信息。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.