Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

idogridish2
Contributor II

One mashup for two server nodes

hello,

I have a mashup and two nodes,one central and on for usa.

do i need to use two mashups? since each server (node) has its own url?

thank.

ido.

Tags (2)
3 Replies
lironbaram
Honored Contributor II

Re: One mashup for two server nodes

Hi

assuming your installation is Central and rim

you can use the same mashup for the two servers ,

a folder with the mashup is created in the extension folder

so if you can use same extension on the same folder you should be able to use the same mashup

idogridish2
Contributor II

Re: One mashup for two server nodes

Hi liron,

But i have two different url for each node and the mashup extention can hold only one url wrriten inside the mashup js.

How can i make it work dynamicly so it doesnt matter from what url (server) i am connecting to the mashup it will work.

Currently i can access the mashup from the central node that its url is hard coded in the script.

Thanks.

erik_wetterberg
Valued Contributor III

Re: One mashup for two server nodes

Hi ido,

Try to avoid hard-coding the urls in your mashup, it is almost always possible, check out the mashup examples delivered with Qlik Sense for an example.

In html files you can use relative links:

<script src="../../resources/assets/external/requirejs/require.js"></script>  

   

In the javascript file you can use window.location:

var prefix = window.location.pathname.substr(0, window.location.pathname.toLowerCase().lastIndexOf("/extensions") + 1);


var config = {

    host: window.location.hostname,

    prefix: prefix,

    port: window.location.port,

    isSecure: window.location.protocol === "https:"

};


require.config({

    baseUrl: (config.isSecure ? "https://" : "http://") + config.host + (config.port ? ":" + config.port : "") + config.prefix + "resources"

});

Hope this helps

Erik Wetterberg

Erik Wetterberg
https://extendingqlik.upper88.com/