Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Qlik Sense redirect HTTP to HTTPS

Hi all,

We have a Qlik Sense server installed and running on a OVH Private Cloud instance. In order to make the access easier to the users we need to redirect all the traffic of http://qlik.company.com to https://qlik.company.com.

I read about it and I saw a lot of posts that suggest to use a IIS o Nginx Proxy service to set up the reverse proxy but in all posts this scenario the tools are installed on a second server.


Anyone have any experience to do on the same server? Meaning, Qlik Sense + IIS or Qlik Sense + Nginx in the same server.


Any other options? There is a way to do it using the "Proxy Service" or an external tool of Qlik Sense?


Thank's in advance!

1 Solution

Accepted Solutions
Levi_Turner
Employee
Employee

This worked historically doing some quick validation tests.


Method (assumption is that Qlik Sense is *not* running on port 80)

  • Download Nginx (http://nginx.org/download/nginx-1.13.8.zip)
  • Unpack so that the file structure is C:\Nginx\nginx.exe
  • Backup C:\nginx\conf\nginx.conf
  • Open C:\nginx\conf\nginx.conf
  • Swap out with this conf file ; an example)
  • Cmd.exe
    • cd C:\nginx
    • nginx.exe
  • Validate
  • Kill the EXEs in Task Manager before trying to install as a service

To install as a service:

  • Download Nuget (https://dist.nuget.org/win-x86-commandline/latest/nuget.exe)
  • Place in C:\nuget
  • Cmd.exe
    • cd nuget
    • nuget.exe install WinSW
  • Rename C:\nuget\WinSW.2.1.2\lib\net40-full\WinSW.NET4.exe to C:\nuget\WinSW.2.1.2\lib\net40-full\nginxservice.exe
  • Backup C:\nuget\WinSW.2.1.2\lib\net40-full\WinSW.NET4.xml
  • Place attached XML in C:\nuget\WinSW.2.1.2\lib\net40-full\
  • cmd.exe
    • cd C:\nuget\WinSW.2.1.2\lib\net40-full
    • nginxservice.exe install
  • Validate

Uninstall steps:

  • nginxservice.exe stop
  • nginxservice.exe uninstall

nginx.conf:


#user  nobody;

worker_processes  1;


#error_log  logs/error.log;

#error_log  logs/error.log  notice;

#error_log  logs/error.log  info;


#pid        logs/nginx.pid;



events {

    worker_connections  1024;

}



http {

    include       mime.types;

    default_type  application/octet-stream;


    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

    #                  '$status $body_bytes_sent "$http_referer" '

    #                  '"$http_user_agent" "$http_x_forwarded_for"';


    #access_log  logs/access.log  main;


    sendfile        on;

    #tcp_nopush     on;


    #keepalive_timeout  0;

    keepalive_timeout  65;


    #gzip  on;


    server {

        listen       80;

        server_name  localhost;


        #charset koi8-r;


        #access_log  logs/host.access.log  main;


        # location / {

        #     root   html;

        #     index  index.html index.htm;

        # }

location / {

root   html;

proxy_set_header   X-Real-IP $remote_addr;

proxy_set_header   Host      $http_host;

proxy_pass         https://localhost:443;

}


        #error_page  404              /404.html;


        # redirect server error pages to the static page /50x.html

        #

        error_page   500 502 503 504  /50x.html;

        location = /50x.html {

            root   html;

        }


        # proxy the PHP scripts to Apache listening on 127.0.0.1:80

        #

        #location ~ \.php$ {

        #    proxy_pass   http://127.0.0.1;

        #}


        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

        #

        #location ~ \.php$ {

        #    root           html;

        #    fastcgi_pass   127.0.0.1:9000;

        #    fastcgi_index  index.php;

        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

        #    include        fastcgi_params;

        #}


        # deny access to .htaccess files, if Apache's document root

        # concurs with nginx's one

        #

        #location ~ /\.ht {

        #    deny  all;

        #}

    }



    # another virtual host using mix of IP-, name-, and port-based configuration

    #

    #server {

    #    listen       8000;

    #    listen       somename:8080;

    #    server_name  somename  alias  another.alias;


    #    location / {

    #        root   html;

    #        index  index.html index.htm;

    #    }

    #}



    # HTTPS server

    #

    #server {

    #    listen       443 ssl;

    #    server_name  localhost;


    #    ssl_certificate      cert.pem;

    #    ssl_certificate_key  cert.key;


    #    ssl_session_cache    shared:SSL:1m;

    #    ssl_session_timeout  5m;


    #    ssl_ciphers  HIGH:!aNULL:!MD5;

    #    ssl_prefer_server_ciphers  on;


    #    location / {

    #        root   html;

    #        index  index.html index.htm;

    #    }

    #}


}

nginxservice.xml

<service>

  <id>nginx</id>

  <name>nginx</name>

  <description>nginx</description>

  <executable>c:\nginx\nginx.exe</executable>

  <logpath>c:\nginx\logs\</logpath>

  <logmode>roll</logmode>

  <depend></depend>

  <startargument>-p</startargument>

  <startargument>c:\nginx</startargument>

  <stopexecutable>c:\nginx\nginx.exe</stopexecutable>

  <stopargument>-p</stopargument>

  <stopargument>c:\nginx</stopargument>

  <stopargument>-s</stopargument>

  <stopargument>stop</stopargument>

</service>

View solution in original post

5 Replies
Levi_Turner
Employee
Employee

This worked historically doing some quick validation tests.


Method (assumption is that Qlik Sense is *not* running on port 80)

  • Download Nginx (http://nginx.org/download/nginx-1.13.8.zip)
  • Unpack so that the file structure is C:\Nginx\nginx.exe
  • Backup C:\nginx\conf\nginx.conf
  • Open C:\nginx\conf\nginx.conf
  • Swap out with this conf file ; an example)
  • Cmd.exe
    • cd C:\nginx
    • nginx.exe
  • Validate
  • Kill the EXEs in Task Manager before trying to install as a service

To install as a service:

  • Download Nuget (https://dist.nuget.org/win-x86-commandline/latest/nuget.exe)
  • Place in C:\nuget
  • Cmd.exe
    • cd nuget
    • nuget.exe install WinSW
  • Rename C:\nuget\WinSW.2.1.2\lib\net40-full\WinSW.NET4.exe to C:\nuget\WinSW.2.1.2\lib\net40-full\nginxservice.exe
  • Backup C:\nuget\WinSW.2.1.2\lib\net40-full\WinSW.NET4.xml
  • Place attached XML in C:\nuget\WinSW.2.1.2\lib\net40-full\
  • cmd.exe
    • cd C:\nuget\WinSW.2.1.2\lib\net40-full
    • nginxservice.exe install
  • Validate

Uninstall steps:

  • nginxservice.exe stop
  • nginxservice.exe uninstall

nginx.conf:


#user  nobody;

worker_processes  1;


#error_log  logs/error.log;

#error_log  logs/error.log  notice;

#error_log  logs/error.log  info;


#pid        logs/nginx.pid;



events {

    worker_connections  1024;

}



http {

    include       mime.types;

    default_type  application/octet-stream;


    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

    #                  '$status $body_bytes_sent "$http_referer" '

    #                  '"$http_user_agent" "$http_x_forwarded_for"';


    #access_log  logs/access.log  main;


    sendfile        on;

    #tcp_nopush     on;


    #keepalive_timeout  0;

    keepalive_timeout  65;


    #gzip  on;


    server {

        listen       80;

        server_name  localhost;


        #charset koi8-r;


        #access_log  logs/host.access.log  main;


        # location / {

        #     root   html;

        #     index  index.html index.htm;

        # }

location / {

root   html;

proxy_set_header   X-Real-IP $remote_addr;

proxy_set_header   Host      $http_host;

proxy_pass         https://localhost:443;

}


        #error_page  404              /404.html;


        # redirect server error pages to the static page /50x.html

        #

        error_page   500 502 503 504  /50x.html;

        location = /50x.html {

            root   html;

        }


        # proxy the PHP scripts to Apache listening on 127.0.0.1:80

        #

        #location ~ \.php$ {

        #    proxy_pass   http://127.0.0.1;

        #}


        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

        #

        #location ~ \.php$ {

        #    root           html;

        #    fastcgi_pass   127.0.0.1:9000;

        #    fastcgi_index  index.php;

        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

        #    include        fastcgi_params;

        #}


        # deny access to .htaccess files, if Apache's document root

        # concurs with nginx's one

        #

        #location ~ /\.ht {

        #    deny  all;

        #}

    }



    # another virtual host using mix of IP-, name-, and port-based configuration

    #

    #server {

    #    listen       8000;

    #    listen       somename:8080;

    #    server_name  somename  alias  another.alias;


    #    location / {

    #        root   html;

    #        index  index.html index.htm;

    #    }

    #}



    # HTTPS server

    #

    #server {

    #    listen       443 ssl;

    #    server_name  localhost;


    #    ssl_certificate      cert.pem;

    #    ssl_certificate_key  cert.key;


    #    ssl_session_cache    shared:SSL:1m;

    #    ssl_session_timeout  5m;


    #    ssl_ciphers  HIGH:!aNULL:!MD5;

    #    ssl_prefer_server_ciphers  on;


    #    location / {

    #        root   html;

    #        index  index.html index.htm;

    #    }

    #}


}

nginxservice.xml

<service>

  <id>nginx</id>

  <name>nginx</name>

  <description>nginx</description>

  <executable>c:\nginx\nginx.exe</executable>

  <logpath>c:\nginx\logs\</logpath>

  <logmode>roll</logmode>

  <depend></depend>

  <startargument>-p</startargument>

  <startargument>c:\nginx</startargument>

  <stopexecutable>c:\nginx\nginx.exe</stopexecutable>

  <stopargument>-p</stopargument>

  <stopargument>c:\nginx</stopargument>

  <stopargument>-s</stopargument>

  <stopargument>stop</stopargument>

</service>

Anonymous
Not applicable
Author

Hi Levi,

Your assumption is right, we don't have Qlik Sense and other any application listening to the port 80.

If I understand, we have two options:

  1. Unpack files and run as "application" so we will need to start the application when the server starts up.
  2. Install as a service so it will be up when the server starts without any additional acctions (if the service is configured to starts automatically).

Is that right? In both installations we need to edit ngix.conf, right?

Thank's!

Levi_Turner
Employee
Employee

Correct

Anonymous
Not applicable
Author

Hi Levi,

Is working good on the server. When we ask for http://localhost or http://qlik.company.com the nginx redirects to https://localhost or https://qlik.company.com but when we tried in a client don't work.

Any idea?

Thank's

Anonymous
Not applicable
Author

Hi Levi,

It's working fine. Our firewall was blocking the petitions for port 80.

Thank's a lot for your help!