Skip to content

Commit b9fb3b5

Browse files
committed
Set CORS headers for both http/https in SSVM apache config
1 parent afdf4d7 commit b9fb3b5

4 files changed

Lines changed: 6 additions & 32 deletions

File tree

services/secondary-storage/controller/src/main/java/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,10 +1204,6 @@ public boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile, Depl
12041204
logger.debug(String.format("Boot args for machine profile [%s]: [%s].", profile.toString(), bootArgs));
12051205
}
12061206

1207-
boolean useHttpsToUpload = BooleanUtils.toBooleanDefaultIfNull(VolumeApiService.UseHttpsToUpload.value(), true);
1208-
logger.debug(String.format("Setting UseHttpsToUpload config on cmdline with [%s] value.", useHttpsToUpload));
1209-
buf.append(" useHttpsToUpload=").append(useHttpsToUpload);
1210-
12111207
addSecondaryStorageServerAddressToBuffer(buf, secStores, vmName);
12121208

12131209
return true;

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
@@ -918,9 +918,6 @@ parse_cmd_line() {
918918
privateMtu)
919919
export PRIVATEMTU=$VALUE
920920
;;
921-
useHttpsToUpload)
922-
export USEHTTPS=$VALUE
923-
;;
924921
vncport)
925922
export VNCPORT=$VALUE
926923
;;

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)