server {
  listen {{ CS_FRONTEND_HTTP_PORT | last }};
  listen [::]:{{ CS_FRONTEND_HTTP_PORT | last }};
  include /etc/nginx/includes/ssl*conf;
  root /var/www/r7-office/calendar;
  index index.html;

  server_name {{ CS_FRONTEND_PREFIX_CALENDAR | last }}.{{ CS_FRONTEND_DOMAIN | last }};

  location /api {
    proxy_set_header X-real-ip $remote_addr;
    proxy_set_header X-forward-for $proxy_add_x_forwarded_for;
    proxy_set_header X-Module Calendar;
    proxy_pass http://{{ CS_API_HOST | last }}:{{ CS_API_PORT | last }}/api;
  }

#  location /source {
#    proxy_pass http://{{ CS_API_HOST | last }}:{{ CS_API_PORT | last }};
#   proxy_pass {{ CS_FRONTEND_SCHEME | last }}://{{ CS_FRONTEND_PREFIX_CDDISK | last }}.{{ CS_FRONTEND_DOMAIN | last }};
#  }

  location / {
    try_files $uri $uri/ /index.html;
  }
}
