forked from 1024pix/pix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathservers.conf.erb
More file actions
52 lines (41 loc) · 1.27 KB
/
servers.conf.erb
File metadata and controls
52 lines (41 loc) · 1.27 KB
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
log_format keyvalue
'method=$request_method'
' path="$request_uri"'
' host=$host'
' request_id=$http_x_request_id'
' from="$remote_addr"'
' protocol=$scheme'
' status=$status'
' duration=${request_time}s'
' bytes=$bytes_sent'
' referer="$http_referer"'
' user_agent="$http_user_agent"';
# In order to avoid logging access twice per request
# it is necessary to turn off the top-level (e.g. http) buildpack default access_log
# as we are about to override it in the server directive here below
access_log off;
server {
access_log logs/access.log keyvalue;
server_name localhost;
listen <%= ENV['PORT'] %>;
charset utf-8;
# Disable compression that is performed by the Scalingo router anyway
gzip off;
location ~ ^/(?<app>[^/]+)/.*$ {
root /app/dist/;
try_files $uri /$app/index.html =404;
expires -1;
}
add_header X-Content-Type-Options "nosniff";
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection 1;
<% ENV.each do |key,value| %>
<% if key.start_with? 'ADD_HTTP_HEADER' %>
add_header <%=
key.sub(/^ADD_HTTP_HEADER_/, '').split("_").map(&:capitalize).join("-")
%> "<%=
value.gsub('\\', '\\\\\\\\').gsub('"','\\"').gsub('$','\\$')
%>" ;
<% end %>
<% end %>
}