Skip to content

giosg Proxy

Info

This functionality is only available as separately sold product. Please contact us at sales@giosg.com in order to get more information.

Overview

giosg Proxy is a separately sold product, which allows our Customers to host their own proxy server between website visitors and giosg servers. Proxy server receives all requests from the visitor's browser, forwards those to giosg servers and then returns server responses to the visitors with the appearance of it coming from the proxy server itself.

For example, you could have an existing website such as bank.com. By using a proxy setup, the giosg content would appear to be hosted from the chat.bank.com server when it's actually coming from giosg's servers. We could call this also as a server whitelabeling.

proxy setup

If communication between giosg servers and your website visitor is routed through the proxy:

  • For the website visitors it looks like the service is located on your datacenter
  • Your company has visibility to the communication. You can monitor what has been transmitted between giosg and your end customers
  • In case of emergency, you can suspend the service simply by closing the proxy

Prerequisites

It's recommended that you first read giosg - How does the v2 giosg script work, so you have basic understanding about giosg script.

Reference proxy implementation

Giosg has test proxy proxy-test.giosg.com, which can be used as reference implementation for testing the proxy setup. We are also using this as an example when explaining proxy related settings.

Setting up the Proxy

Proxy settings

Warning

Do not set proxy urls before you have working proxy server, because settings are immediately activated for all of your website visitors.

If giosg Proxy product has been activated to you giosg account, you can find proxy configuration as part of the Settings -> Company -> Company settings.

proxy setup

By setting the "Proxy url for giosg script" config parameter, all url resources inside are pointing to this url-prefix instead of the https://service.giosg.com. For the reference proxy implementation, the value for this field would be https://proxy-test.giosg.com/.

Interactions are using a separate "CDN url for interactions" config. This allows interactions to fetch resources like pictures and fonts also in the situations where interactions are loaded by third party code without giosg script.

Script tag

Proxy can be used with the default V2 script tag, however then the first request will point directly to service.giosg.com domain instead of your proxy server. In order to change this first request functionality, you should use a modified script tag with a proxy domain. You can find your unique tag under Settings -> Company -> Script tag after you have added the proxy settings.

For the reference proxy implementation proxy-test.giosg.com, the script tag is:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!-- giosg tag -->
<script>
  (function (w, t, f) {
    var s = "script",
      o = "_giosg",
      h = "https://proxy-test.giosg.com/",
      e,
      n;
    e = t.createElement(s);
    e.async = 1;
    e.src = h + "/live2/" + f;
    w[o] =
      w[o] ||
      function () {
        (w[o]._e = w[o]._e || []).push(arguments);
      };
    w[o]._c = f;
    w[o]._h = h;
    n = t.getElementsByTagName(s)[0];
    n.parentNode.insertBefore(e, n);
  })(window, document, '826100fd-b473-49b0-bafd-d7332622bae8');
</script>
<!-- giosg tag -->

Setting up the proxy server

Below you can find nginx configuration which can be used as is for the proxy server, or you can use some other proxy technology and use this configuration as an example for your own setup. This configuration is also used by proxy-test.giosg.com reference implementation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log notice;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/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  /var/log/nginx/access.log  main;

    sendfile        off;

    keepalive_timeout  65;

    gzip  on;

    map $http_upgrade $connection_upgrade {
        default upgrade;
        '' close;
    }

    map $request_uri $interaction_uuid {
        default "undefined";
        "~^/interactions/([^/]+)/.*?$" "$1";
    }

    map $request_uri $interaction_resource {
        default "undefined";
        "~^/interactions/[^/]+/(.*?)$" "$1";
    }

    server {
        listen       80;

        return 301 https://$host$request_uri;
    }

    server {
        listen       443 ssl;
        ssl_certificate     /usr/local/nginx/conf/cert.pem;
        ssl_certificate_key /usr/local/nginx/conf/cert.key;

        proxy_ssl_server_name on;
        proxy_intercept_errors on;

        resolver 8.8.8.8 valid=300s ipv6=off;

        location / {
            return 404;
        }

        location ~ ^/(live|live2|api|credentials|static|visitor_dialog_iframe|giosg_api|bar)/ {
            proxy_pass https://service.giosg.com;
        }

        location /websocket {
            proxy_pass https://messagerouter.giosg.com;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;
        }

        location /apigateway/ {
            proxy_pass https://api.giosg.com/;
        }

        location = /interactions/player.js {
            proxy_pass https://globalcdn.interactionbuilder.giosg.com/player.js;
        }

        location /interactions/ {
            proxy_set_header Host $interaction_uuid.interactions.giosgusercontent.com;
            proxy_pass https://uuid.interactions.giosgusercontent.com/$interaction_resource;
        }

        location /assets-cdn/ {
            proxy_pass https://cdn.giosgusercontent.com/;
        }
    }
}

Additional info

Please contact us at support@giosg.com in order to get more information.