upstream django {
	server unix:///run/uwsgi/app/ews.sock;
}

server {
	listen 8080 default_server bind deferred;
	server_name _;
	proxy_intercept_errors on;

	# Грязный хак. Принудительно обрабатываем ошибку 400
	#error_page 400 =200 @ECOM3k;

	location / {
		gzip on;
		root /home/www-python/EmcosWebServices/django-backend/static;
		index index.html;
	}

	location /static {
		gzip on;
		add_header Access-Control-Allow-Origin *;
		alias /home/www-python/EmcosWebServices/django-backend/static;
	}

	location /crq {
		gzip off;
		keepalive_requests 0;
		keepalive_timeout 0;
		fastcgi_connect_timeout 300s;
		chunked_transfer_encoding off;
		include uwsgi_params;
		uwsgi_pass django;
	}

	location ~ ^/(?!(static|crq)) {
		gzip on;
		add_header Access-Control-Allow-Origin *;
		include uwsgi_params;
		uwsgi_param Host $host;
		uwsgi_param X-Real-IP $remote_addr;
		uwsgi_param X-Forwarded-For $proxy_add_x_forwarded_for;
		uwsgi_param X-Forwarded-Proto $http_x_forwarded_proto;
		uwsgi_pass django;
	}
}