Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
idogridish2
Creator II
Creator 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.

3 Replies
lironbaram
Partner - Master III
Partner - Master III

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
Creator II
Creator II
Author

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.

ErikWetterberg

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