Hi guys,
I am setting up a redirect for HTTP to HTTPs by Apache 2.4 for my Appian v18.1 site installed in Ubuntu 16.04
I followed the Appian Guide and included the lines below in my Apache httpd.conf file.
https://docs.appian.com/suite/help/18.1/Configuring_Apache_Web_Server_with_JBoss.html
<VirtualHost *:80> ServerAlias * RewriteEngine on RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [L,R] </VirtualHost>
But the site failed to redirect to https when i hardcode http://xxx.com/suite/ in the url. Do you have any clues?
Thanks in advance.
Discussion posts and replies are publicly visible
Dear AdityaU (adityau0001)
Thank you for your reply.
When I hardcode https://xxx.com/suite/ in the url, the site could be run properly and users could be logged In, so it could be concluded that the certificates and SERVER_AND_PORT property are correctly set.
Indeed, for the custom.properties file, i merely changed the conf.suite.SCHEME value from http to https and the conf.suite.SERVER_AND_PORT value was remained as xxx.com
Have you enabled HTTPs on your web server?
I didn't specify the port, ain't the port should be default as 443?
it don't seems to be the problem of accessing HTTPS, but unable to REDIRECT the HTTP
Here are a few snaps shot for my settings:
could you try below code in your httpd.conf file <VirtualHost *:80> ServerName www.xxx.com Redirect "/" "https://www.xxx.com/" </VirtualHost>
Thanks @AdityaU for your advice,but it does not work for me...
Yes, I saved the conf file as .txt file just to upload it here.
JKWorkerProperty worker.list=LoadBalancer JKWorkerProperty worker.node1.host=xxx.com JKWorkerProperty worker.node1.port=8009 JKWorkerProperty worker.node1.type=ajp13 JKWorkerProperty worker.node1.socket_connect_timeout=5000 JKWorkerProperty worker.LoadBalancer.type=lb JKWorkerProperty worker.LoadBalancer.balance_workers=node1 JKWorkerProperty worker.LoadBalancer.sticky_session=1 SSLRandomSeed startup builtin SSLRandomSeed connect builtin SSLSessionCache shmcb:/tmp/ssl_gcache_data(512000) SSLCertificateFile "/etc/apache2/conf/apache.crt" SSLCertificateKeyFile "/etc/apache2/conf/apache.key" SSLCertificateChainFile "/etc/apache2/conf/apache.crt" # Should mod_jk send SSL information to the application server (default is On) JkExtractSSL On # What is the indicator for SSL (default is HTTPS) JkHTTPSIndicator HTTPS # What is the indicator for SSL session (default is SSL_SESSION_ID) JkSESSIONIndicator SSL_SESSION_ID # What is the indicator for client SSL cipher suit (default is SSL_CIPHER) JkCIPHERIndicator SSL_CIPHER # What is the indicator for the client SSL certificated (default is SSL_CLIENT_CERT) JkCERTSIndicator SSL_CLIENT_CERT # Allow all vhost to inherit mounts from the main server (default is Off) JkMountCopy All <VirtualHost *:80> ServerAlias * RewriteEngine on RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [L,R] </VirtualHost> <VirtualHost *:443> ServerName xxx.com SSLEngine on </VirtualHost> DocumentRoot "/etc/apache2/www" <Location /suite/> SetHandler jakarta-servlet SetEnv JK_WORKER_NAME LoadBalancer SetEnvIf REQUEST_URI "\.css$" no-jk SetEnvIf REQUEST_URI "\.jpg$" no-jk SetEnvIf REQUEST_URI "\.js$" no-jk SetEnvIf REQUEST_URI "\.html$" no-jk SetEnvIf REQUEST_URI "\.png$" no-jk SetEnvIf REQUEST_URI "\.xml$" no-jk SetEnvIf REQUEST_URI "\.ico$" no-jk SetEnvIf REQUEST_URI "\.xsl$" no-jk SetEnvIf REQUEST_URI "\.gwt\.rpc$" no-jk SetEnvIf REQUEST_URI "\.svg$" no-jk SetEnvIf REQUEST_URI "\.htc$" no-jk SetEnvIf REQUEST_URI "\.otf$" no-jk # If the nosniff setting for the X-Content-Type-Options response # header is used, omit the SetEnvIf line for .gif extenstions. SetEnvIf REQUEST_URI "\.gif$" no-jk SetEnvIf REQUEST_URI "/suite/s/" !no-jk SetEnvIf REQUEST_URI "/suite/plugins/servlet" !no-jk </Location> <Location /extras/> SetHandler jakarta-servlet SetEnv JK_WORKER_NAME LoadBalancer </Location> JkStripSession On <Directory "/etc/apache2/www/suite"> AllowOverride FileInfo Require all granted </Directory> <LocationMatch "/suite/JSON-RPC"> Header set Cache-Control no-store </LocationMatch> <LocationMatch "/suite/doc"> Header set Cache-Control no-store </LocationMatch> <LocationMatch "\.(?i:do|bg|popup)$"> Header set Cache-Control no-store </LocationMatch> <Directory "/etc/apache2"> ExpiresActive On <FilesMatch "\.(css|jpg|gif|js|html|png|xml|ico|xsl|gwt\.rpc|eot|svg|tff|woff)$"> ExpiresDefault "now plus 1 hour" </FilesMatch> <Files "*.cache.html"> ExpiresDefault "now plus 1 day" </Files> <FilesMatch "\.cache\.(js|css|less)"> ExpiresDefault "now plus 1 year" </FilesMatch> <Files "*.nocache.js"> ExpiresDefault "now" Header set Cache-Control "max-age=0, must-revalidate" </Files> </Directory> Timeout 300 KeepAlive On KeepAliveTimeout 60
Dear AdityaU (adityau0001) ,
I have found the solution.
The key is to put the Redirect Sections (i.e. <VirtualHost *:80> and <VirtualHost *:443>) in the /etc/apache2/sites-available/000-default.conf file instead of etc/apache2/httpd.conf file
Now my site is able to be redirected.
Thanks for your help! :)