# Virtual Host config for myhost.com
NameVirtualHost *:80
<VirtualHost *:80>
ServerName myhost.com
ServerAlias myhost
ServerAdmin admin@myhost.com
DocumentRoot /var/www/myhost
ErrorLog /var/log/httpd/myhost/error_log
LogLevel warn
RewriteEngine On
RewriteCond %{HTTPS} off
#RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteRule ^.*$ https://myhost.com%{REQUEST_URI} [L,R]
</VirtualHost>
<VirtualHost *:443>
ServerName myhost.com
ServerAlias myhost
ServerAdmin admin@myhost.com
DocumentRoot /var/www/myhost
CustomLog /var/log/httpd/myhost/access_log combined env=!dontlog
SetEnvIf Request_URI "^/status\.html$" dontlog
ErrorLog /var/log/httpd/myhost/error_log
LogLevel warn
RewriteEngine On
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
SSLCertificateFile /etc/pki/tls/certs/myhost.crt
SSLCertificateKeyFile /etc/pki/tls/certs/myhost.key
SSLCACertificateFile /etc/pki/tls/certs/ca-bundle.crt
ProxyRequests On
ProxyVia On
ProxyReceiveBufferSize 16384
### Production with FastCGI
Alias /myapp /var/www/MyApp/script/myapp_fastcgi.sh/
<Directory /var/www/MyApp/script/>
SetHandler fcgid-script
Options +ExecCGI
Order allow,deny
Allow from all
</Directory>
## Development Using builtin server
Alias /myapp/static /var/www/MyApp/root/myapp/static
<Directory /var/www/MyApp/root/myapp/static>
Options Includes FollowSymLinks Indexes
order Allow,Deny
allow from all
</Directory>
<Location /myapp>
# You must have mod_headers enabled for that
# RequestHeader set X-Request-Base /preview
SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1
SSLRequireSSL
SetHandler perl-script
RequestHeader set X-URL-SCHEME https
RequestHeader set X-Request-Base https://myhost.com/myapp
</Location>
ProxyPass /myapp http://localhost:8080
ProxyPassReverse /myapp http://localhost:8080
</VirtualHost>
in MyApp/lib/MyApp
use CatalystX::RoleApplicator;
extends 'Catalyst';
__PACKAGE__->config->{using_frontend_proxy} = 1;
__PACKAGE__->config->{"X-Forwarded-Port"} = 443;
__PACKAGE__->apply_request_class_roles(qw/
Catalyst::TraitFor::Request::ProxyBase
/);
__PACKAGE__->setup();
This module was originally developed at and for Weill Cornell Medical College in Qatar within ITS Advanced Computing Team. With approval from WCMC-Q, this information was generalized and put on github, for which the authors would like to express their gratitude.