Question

The link for JavaScript and CSS files appear to have an absolute URL like:

    <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">

but I would like them to be:

    <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">

It is also similar to the link on Screen.

I would like to have them relative, then it can be possible to add a reverse proxy in front of the application.

Was it helpful?

Solution

These come from the Header.html.ftl file in the webroot component and use values like this:

${sri.buildUrl(scriptLocation).url}

There are many URLs generated like this with the full URL including hostname and such. When not running locally you'll almost always need to set the external hostname and ports in the Moqui Conf XML file. For example:

<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>

Note that this still has https-enabled="false". If you set that to true also set the @https-host and @https-post attributes.

Note that if you leave any of http-host, http-port, https-host, or https-port empty they will default to the hostname and port on the HTTP request. This is the way to handle it for virtual hosting for multi-tenant or multi-root screen setups. For this to work it is necessary that any load balancer or other other proxy (such as mod-proxy on httpd) be setup to pass through this HTTP request information.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top