VMware App Volumes – Redirect HTTP to HTTPS
VMware App Volumes communicate throughhttp and https protocol. Since, http sends data in clear text, people like to use https protocol.
There are number of VMware KB those describe about how to configure systems for https communication. One of the VMware KBs number 2095972 mentioned how to disable port 80 (http) from manager. But disabling http port give a nasty error 403 /404, while user try to access using http protocol.
To make it look better to users, it is always good idea to redirect http request to https. So there will be no error messge from browser and all communcation will be secure with SSL.
To redirect http request to https for App Volumes, follow these steps.
1. Log in to your App Volumes Manager server.
2. Copy nginx.conf file located at D:\Program Files(x86)\CloudVolumes\Manager\nginx\conf\nginx.conf to nginx.conf.old for backup.
3. Edit nginx.conf file using notepad.
4. Replace these lines with the Red lines:
server {
server_name 0.0.0.0;
listen 80;
root ../public;
rewrite ^/(.*)/$ /$1 permanent;
#access_log off;
access_log logs/access_http.log main;
error_log logs/error_http.log info;
charset utf-8;
override_charset on;
gzip on;
gzip_types application/json application/javascript;
error_page 404 /404.html;
error_page 502 /502.html;
#error_page 500 502 503 504 /500.html;
location ~* ^.+\.(jpg|jpeg|gif|png|ico)$ {
expires max;
break;
}
location ~* ^.+\.(css|js|htm|html|json)$ {
#expires 0; # expire immediately
expires 5m;
break;
}
location / {
try_files /index.html @manager;
}
location @manager {
proxy_connect_timeout 10;
#proxy_next_upstream off;
proxy_next_upstream timeout;
proxy_read_timeout 600;
proxy_send_timeout 30;
send_timeout 30;
proxy_redirect off;
server_name_in_redirect off;
proxy_pass_header Cookie;
proxy_pass_header Set-Cookie;
proxy_pass_header X-Accel-Redirect;
proxy_set_header Host $host:80;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
add_header X-Backend $upstream_addr;
proxy_pass http://backend;
}
}
server {
server_name _;
listen 80 default_server;
listen [::]:80 default_server;
return 301 https://$host$request_uri;
}
5. Click Start > Run, type services.msc, and click OK. The Services window opens.
6. Restart App Volumes Manager service.