Skip to content

Commit e1d512e

Browse files
authored
Set CORS headers for both http/https in SSVM apache config (#9389)
1 parent c1c1b0e commit e1d512e

File tree

3 files changed

+6
-28
lines changed

3 files changed

+6
-28
lines changed

systemvm/debian/etc/apache2/vhost.template

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
Allow from 127.0.0.0/255.0.0.0 ::1/128
4040
</Directory>
4141

42-
# Include HTTP configuration **IF SET**
43-
IncludeOptional /etc/apache2/http.conf
42+
# Include CORS configuration **IF SET**
43+
IncludeOptional /etc/apache2/cors.conf
4444

4545
</VirtualHost>
4646

@@ -86,8 +86,8 @@
8686
Allow from 127.0.0.0/255.0.0.0 ::1/128
8787
</Directory>
8888

89-
# Include HTTPS configuration **IF SET**
90-
IncludeOptional /etc/apache2/https.conf
89+
# Include CORS configuration **IF SET**
90+
IncludeOptional /etc/apache2/cors.conf
9191

9292
# SSL Engine Switch:
9393
# Enable/Disable SSL for this virtual host.

systemvm/debian/opt/cloud/bin/setup/common.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -924,9 +924,6 @@ parse_cmd_line() {
924924
privateMtu)
925925
export PRIVATEMTU=$VALUE
926926
;;
927-
useHttpsToUpload)
928-
export USEHTTPS=$VALUE
929-
;;
930927
vncport)
931928
export VNCPORT=$VALUE
932929
;;

systemvm/debian/opt/cloud/bin/setup/secstorage.sh

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -50,33 +50,14 @@ setup_secstorage() {
5050
a2enmod proxy_http
5151
a2enmod headers
5252

53-
if [ -z $USEHTTPS ] | $USEHTTPS ; then
54-
if [ -f /etc/apache2/http.conf ]; then
55-
rm -rf /etc/apache2/http.conf
56-
fi
57-
cat >/etc/apache2/https.conf <<HTTPS
53+
cat >/etc/apache2/cors.conf <<CORS
5854
RewriteEngine On
59-
RewriteCond %{HTTPS} =on
6055
RewriteCond %{REQUEST_METHOD} =POST
6156
RewriteRule ^/upload/(.*) http://127.0.0.1:8210/upload?uuid=\$1 [P,L]
6257
Header always set Access-Control-Allow-Origin "*"
6358
Header always set Access-Control-Allow-Methods "POST, OPTIONS"
6459
Header always set Access-Control-Allow-Headers "x-requested-with, content-type, origin, authorization, accept, client-security-token, x-signature, x-metadata, x-expires"
65-
HTTPS
66-
else
67-
if [ -f /etc/apache2/https.conf ]; then
68-
rm -rf /etc/apache2/https.conf
69-
fi
70-
cat >/etc/apache2/http.conf <<HTTP
71-
RewriteEngine On
72-
RewriteCond %{REQUEST_METHOD} =POST
73-
RewriteRule ^/upload/(.*) http://127.0.0.1:8210/upload?uuid=\$1 [P,L]
74-
Header always set Access-Control-Allow-Origin "*"
75-
Header always set Access-Control-Allow-Methods "POST, OPTIONS"
76-
Header always set Access-Control-Allow-Headers "x-requested-with, content-type, origin, authorization, accept, client-security-token, x-signature, x-metadata, x-expires"
77-
HTTP
78-
fi
79-
60+
CORS
8061

8162
disable_rpfilter
8263
enable_fwding 0

0 commit comments

Comments
 (0)