mirror of https://github.com/apache/cloudstack.git
Set CORS headers for both http/https in SSVM apache config (#9389)
This commit is contained in:
parent
c1c1b0e765
commit
e1d512e5fd
|
|
@ -39,8 +39,8 @@
|
|||
Allow from 127.0.0.0/255.0.0.0 ::1/128
|
||||
</Directory>
|
||||
|
||||
# Include HTTP configuration **IF SET**
|
||||
IncludeOptional /etc/apache2/http.conf
|
||||
# Include CORS configuration **IF SET**
|
||||
IncludeOptional /etc/apache2/cors.conf
|
||||
|
||||
</VirtualHost>
|
||||
|
||||
|
|
@ -86,8 +86,8 @@
|
|||
Allow from 127.0.0.0/255.0.0.0 ::1/128
|
||||
</Directory>
|
||||
|
||||
# Include HTTPS configuration **IF SET**
|
||||
IncludeOptional /etc/apache2/https.conf
|
||||
# Include CORS configuration **IF SET**
|
||||
IncludeOptional /etc/apache2/cors.conf
|
||||
|
||||
# SSL Engine Switch:
|
||||
# Enable/Disable SSL for this virtual host.
|
||||
|
|
|
|||
|
|
@ -924,9 +924,6 @@ parse_cmd_line() {
|
|||
privateMtu)
|
||||
export PRIVATEMTU=$VALUE
|
||||
;;
|
||||
useHttpsToUpload)
|
||||
export USEHTTPS=$VALUE
|
||||
;;
|
||||
vncport)
|
||||
export VNCPORT=$VALUE
|
||||
;;
|
||||
|
|
|
|||
|
|
@ -50,33 +50,14 @@ setup_secstorage() {
|
|||
a2enmod proxy_http
|
||||
a2enmod headers
|
||||
|
||||
if [ -z $USEHTTPS ] | $USEHTTPS ; then
|
||||
if [ -f /etc/apache2/http.conf ]; then
|
||||
rm -rf /etc/apache2/http.conf
|
||||
fi
|
||||
cat >/etc/apache2/https.conf <<HTTPS
|
||||
RewriteEngine On
|
||||
RewriteCond %{HTTPS} =on
|
||||
RewriteCond %{REQUEST_METHOD} =POST
|
||||
RewriteRule ^/upload/(.*) http://127.0.0.1:8210/upload?uuid=\$1 [P,L]
|
||||
Header always set Access-Control-Allow-Origin "*"
|
||||
Header always set Access-Control-Allow-Methods "POST, OPTIONS"
|
||||
Header always set Access-Control-Allow-Headers "x-requested-with, content-type, origin, authorization, accept, client-security-token, x-signature, x-metadata, x-expires"
|
||||
HTTPS
|
||||
else
|
||||
if [ -f /etc/apache2/https.conf ]; then
|
||||
rm -rf /etc/apache2/https.conf
|
||||
fi
|
||||
cat >/etc/apache2/http.conf <<HTTP
|
||||
cat >/etc/apache2/cors.conf <<CORS
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_METHOD} =POST
|
||||
RewriteRule ^/upload/(.*) http://127.0.0.1:8210/upload?uuid=\$1 [P,L]
|
||||
Header always set Access-Control-Allow-Origin "*"
|
||||
Header always set Access-Control-Allow-Methods "POST, OPTIONS"
|
||||
Header always set Access-Control-Allow-Headers "x-requested-with, content-type, origin, authorization, accept, client-security-token, x-signature, x-metadata, x-expires"
|
||||
HTTP
|
||||
fi
|
||||
|
||||
CORS
|
||||
|
||||
disable_rpfilter
|
||||
enable_fwding 0
|
||||
|
|
|
|||
Loading…
Reference in New Issue