-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathcloudflow.apache.conf
95 lines (80 loc) · 3.04 KB
/
cloudflow.apache.conf
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
##
## Apache >= 2.4 is now required
##
## 1) Enable mod_rewrite,proxy, proxy_http and headers:
## sudo a2enmod rewrite
## sudo a2enmod proxy
## sudo a2enmod proxy_http
## sudo a2enmod headers
## sudo a2enmod ssl
##
## For Mac users to enable modules you need to open the main config usually
## located at /etc/apache2/httpd.conf and uncomment corresponding lines
## starting with "LoadModule". For example to enable "rewrite" there should
## be uncommented line:
##
## LoadModule rewrite_module libexec/apache2/mod_rewrite.so
##
## 2) Change /opt/CloudFlow/ below to match the directory where the dist folder is
##
## 3) To enable https, place your cert and key files and update the path below
##
## 4) Restart apache
##
Listen 8000
<VirtualHost *:8000>
ProxyPreserveHost On
# to enable https, uncomment the following lines, and point to your cert and key files
#SSLEngine On
#SSLProxyEngine On
#SSLCertificateFile /etc/apache2/ssl/apache-selfsigned.crt
#SSLCertificateKeyFile /etc/apache2/ssl/apache-selfsigned.key
DocumentRoot /opt/CloudFlow/dist
RewriteEngine On
# Redirect all /api/... requests to mistral instance
RewriteCond %{HTTPS} =off
RewriteRule . - [E=protocol:http]
RewriteCond %{HTTPS} =on
RewriteRule . - [E=protocol:https]
RewriteRule ^/api/(.*) %{ENV:protocol}://localhost:8989/v2/$1 [P]
ProxyPassReverse "/api/" "http://localhost:8989/v2/"
ProxyPassReverse "/api/" "https://localhost:8989/v2/"
<Directory /opt/CloudFlow/dist>
DirectoryIndex index.html
# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
# Rewrite everything else to index.html to allow html5 state links
RewriteRule ^ index.html [L]
Options Indexes FollowSymLinks MultiViews
AllowOverride None
# Apache 2.4 uses mod_authz_host for access control now (instead of "Allow")
<IfVersion < 2.4>
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
</Directory>
ErrorLog ${APACHE_LOG_DIR}/cloudflow_error.log
CustomLog ${APACHE_LOG_DIR}/cloudflow_access.log combined
# Compress JSON responses
<IfModule mod_deflate.c>
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE application/json
</IfModule>
</IfModule>
Header set Content-Security-Policy "default-src 'self'; img-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline';"
# Make sure index.html is never cached
<filesMatch "\.(html)$">
FileETag None
<ifModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</ifModule>
</filesMatch>
</VirtualHost>