---
apiVersion: v1
kind: ConfigMap
metadata:
  name: onlyoffice-config
  namespace: collab
data:
  http-common.conf: |
    upstream docservice {
      server localhost:8000;
    }

    upstream spellchecker {
      server localhost:8080;
    }

    upstream example {
      server localhost:3000;
    }

    map $http_host $this_host {
        "" $host;
        default $http_host;
    }

    map $http_x_forwarded_proto $the_scheme {
      default $http_x_forwarded_proto;
      "" $scheme;
    }

    map $http_x_forwarded_host $the_host {
        default $http_x_forwarded_host;
        "" $this_host;
    }

    map $http_upgrade $proxy_connection {
      default upgrade;
      "" close;
    }

    proxy_set_header Host $http_host;
    proxy_set_header Upgrade $http_upgrade;
    #proxy_set_header Connection $proxy_connection;
    proxy_set_header X-Forwarded-Host $the_host;
    proxy_set_header X-Forwarded-Proto $the_scheme;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
