Proxying Unstack on the same domain as your web app

In some cases companies have a hard requirement their web application be on the root domain of their website (e.g. https://yourapp.com). Unstack provides options to proxy web traffic to your root domain to give you the best of both worlds. Note, this is advanced functionality and typically requires an engineer to set up.

Web Server Implementations

Nginx

location /app {
    # Point to internal resource
}
location / {
    proxy_set_header Host $host;
    proxy_set_header X-Proxy-Host $host;
    proxy_set_header X-Proxy-Forwarded-For $remote_addr;
    proxy_pass https://YOURSITE.unstackproxy.com/$request_uri;
}

What these mean:

  1. Host tells the Unstack load balancer the URL your visitors are hitting on your web server. This will get overridden by the load balancer, but it's important to pass this if you're using an http scheme, as the load balancer may otherwise return a redirect to an https scheme.
  2. X-Proxy-Host tells Unstack the URL your visitors are hitting on your web server. This helps us tie your traffic to your site.
  3. X-Proxy-Forwarded-For tells Unstack the IP address of your visitors' browsers, so that we can properly record the analytics for them.

Operating System Considerations

Depending on your operating system, there's a chance you may also need to handle domain resolution in the proxy process.

Ubuntu

For Ubuntu, you'll probably need to set up a resolver in /etc/nginx/nginx.conf:

http {
        resolver 127.0.0.1;

You may also have to install dnsmasq as a handler for the DNS resolution.

sudo apt install dnsmasq

In other flavors of Linux, or if you're using Docker containers, you may have to disable conflicting resolvers. 


Your cart

We value your privacy

We use cookies to customize your browsing experience, serve personalized ads or content, and analyze traffic to our site.