Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

problem with mashup hosting, "normal scenario"

Hello

I can’t seem to get mashup hosting up and running

My mashup is hosted on an apache 2.4 server (mydomain.org) which is configured to proxy requests to the Qlik server (mydomain.org/server/ --> qlik server - aka 192.168.1.100 - ) thanks to the following config:

In the mashup html:

<!--Add host to these 3 links if the mashup is on an external webserver-->

<link rel="stylesheet" href="https://mydomain.org/server/resources/autogenerated/qlikui.css">

<link rel="stylesheet" href="https://mydomain.org/server/resources/assets/client/client.css" media="all">

<script src="https://mydomain.org/server/resources/assets/external/requirejs/require.js"></script>

In the mymashup.js config section:

var config = {

    host: "mydomain.org",

    prefix: "/server/",

    port: 443,

    isSecure: true

};

Proxy configuration: (sorry for the lazy security, it's a demo server)

<VirtualHost *:80>

    ServerName mydomain.org

    ProxyPreserveHost On

    ProxyRequests Off

    ProxyPass /server/ http://192.168.1.100/

    ProxyPassReverse /server/ http://192.168.1.100/

    <Location "/server/">

        Require all granted

    </Location>

</VirtualHost>

<VirtualHost *:443>

    ServerName mydomain.org

    SSLEngine On

    SSLProxyEngine On

    ProxyRequests Off

    SSLProxyCheckPeerCN off

    SSLProxyCheckPeerExpire off

    SSLProxyCheckPeerName off

    SSLInsecureRenegotiation on

    SSLProxyVerify none

    SSLVerifyClient none

    SSLCertificateFile /etc/ssl/certs/qlikdemo.crt

    SSLCertificateKeyFile /etc/ssl/certs/qlikdemo.key

    ProxyPass /server/ https://192.168.1.100/

    ProxyPassReverse /server/ https://192.168.1.100/

   

    <Location "/server/">

        Require all granted

    </Location>

</VirtualHost>

Result:

The proxy is working and the retrieval of the qlik resources (qlikui.css, client.css, qlik.js, ... work flawlessly, but

the mymashup.js can't execute the "open app function" :     var app = qlik.openApp("6fe5256a-408d-4c04-86aa-eda18f0a2207", config);

console outputs:

Error from Engine: error { target: WebSocket, isTrusted: true, currentTarget: WebSocket, eventPhase: 2, bubbles: false, cancelable: false, defaultPrevented: false, timeStamp: 1460038720057000, originalTarget: WebSocket, explicitOriginalTarget: WebSocket, NONE: 0 }

Firefox can't connect to  wss://mydomain.org/server/app/6fe5256a-408d-4c04-86aa-eda18f0a2207?reloadUri=http://mydomain.org/mymashup/mymashup.html

I guess something is wrong with websocket, but i've never worked with this before, so I'm kind of stuck there

Any ideas?

Thanks in advance

Thierry

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

I'll answer to myself as I found the solution, may it help others.

My apache configuration missed a rewrite rule for websockets: (in 443 virtual host)

RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket
RewriteRule /(.*) wss://qliksense-server/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket
RewriteRule /(.*) https://qliksense-server/$1 [P,L]

ProxyPass / https://qliksense-server/
ProxyPassReverse / https://qliksense-server/

ProxyPreserveHost On

Credits to DevoKun: Apache2 Proxy Server Recipe for QlikSense to accomodate https and Secure WebSocket (wss) connections...

View solution in original post

2 Replies
Anonymous
Not applicable
Author

I'll answer to myself as I found the solution, may it help others.

My apache configuration missed a rewrite rule for websockets: (in 443 virtual host)

RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket
RewriteRule /(.*) wss://qliksense-server/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket
RewriteRule /(.*) https://qliksense-server/$1 [P,L]

ProxyPass / https://qliksense-server/
ProxyPassReverse / https://qliksense-server/

ProxyPreserveHost On

Credits to DevoKun: Apache2 Proxy Server Recipe for QlikSense to accomodate https and Secure WebSocket (wss) connections...

Anonymous
Not applicable
Author

Tiny update: in order to enable proxy compatibility with Edge, the RewriteCond rule needs to be case insensitive. (because Edge sends the request header HTTP:Upgrade with an uppercase: "Websocket" instead of 'websocket" for Firefox.

Hence the rule update: ([NC] makes the condition case insensitive)

RewriteCond %{HTTP:Upgrade} =websocket [NC]