tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leon Kolchinsky <lkolc...@gmail.com>
Subject Re: Rewrite URLs inside HTML pages?
Date Thu, 05 Aug 2010 01:30:07 GMT
Hi,

Hmm.
Interesting.
Of course I'd like to make it work with "simple configuration" or/and with
JkHTTPSIndicator.

I'm just not clear on how to make this "simple configuration".

As I've said there is no SSL handling on the server side. All SSL request
handled on the load balance level which in turn talks to Apache (configured
to talk to Tomcat via mod_jk) via http.

myserv.mydomain.com - Tomcat server's Domain name
sakai-stg.mydomain.com - Load balancer's Domain name

Clients coming to Load Balancer's URL https://sakai-stg.mydomain.com need to
use internal links (submit forms etc.) which appear as http://
sakai-stg.mydomain.com/..... on the served pages.
Submitting forms is not working in that scenario since the links should look
like this inside the pages - https://sakai-stg.mydomain.com/.....


Please see my mod_jk.conf, workers.properties, 01myserv.mydomain.com.conf
files below.

Can you come up with a solution without using mod_substitute as I do now?

[root@myserv mod_sed]# cat /etc/httpd/conf/mod_jk.conf
LoadModule jk_module modules/mod_jk.so

# mod_jk config
# Where to find workers.properties
# Update this path to match your conf directory location (put
workers.properties next to httpd.conf)
JkWorkersFile /etc/httpd/conf/workers.properties
# Where to put jk shared memory
# Update this path to match your local state directory or logs directory
JkShmFile /var/log/httpd/mod_jk.shm
# Where to put jk logs
# Update this path to match your logs directory location (put mod_jk.log
next to access_log)
JkLogFile /var/log/httpd/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
#JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
# Globally deny access to the WEB-INF directory
<LocationMatch '.*WEB-INF.*'>
AllowOverride None
deny from all
</LocationMatch>

[root@myserv mod_sed]#
[root@myserv mod_sed]# cat /etc/httpd/conf/workers.properties
#
# This file provides minimal jk configuration properties needed to
# connect to Tomcat.
#
# We define a workers named worker1 and worker2
workers.tomcat_home=/srv/tomcat/
workers.java_home=/srv/jdk
ps=/

worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.lbfactor=1


# Load-balancing behaviour (add when you have more than 1 worker and change
worker.workerX.host and worker.list accordingly)
# worker.loadbalancer.type=lb

# Status worker for managing load balancer (add when you have more than 1
worker)
worker.status.type=status

[root@myserv mod_sed]#
[root@myserv mod_sed]# cat
/etc/httpd/conf/vhosts.d/01myserv.mydomain.com.conf
LoadModule substitute_module modules/mod_substitute.so

NameVirtualHost *:80

<VirtualHost *:80>
ServerName myserv.mydomain.com
ServerAdmin Leon.Kolchinsky@mydomain.com
ServerAlias sakai-stg

# Just in case
DocumentRoot /srv/sakai

# if not specified, the global error log is used
ErrorLog /var/log/httpd/myserv.mydomain.com-error_log
CustomLog /var/log/httpd/myserv.mydomain.com-access_log combined
# don't loose time with IP address lookups
HostnameLookups Off
# needed for named virtual hosts
UseCanonicalName Off

# Add index.jsp to DirectoryIndex files
DirectoryIndex index.php index.html index.htm index.shtml index.php4
index.php3 index.phtml index.cgi index.jsp

JkMount /* worker1

AddOutputFilterByType SUBSTITUTE text/html
Substitute "s|http://myserv|https://sakai-stg|i"
Substitute "s|http://sakai-stg|https://sakai-stg|i"

</VirtualHost>


Best Regards,
Leon



On Wed, Aug 4, 2010 at 23:58, Christopher Schultz <
chris@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Leon,
>
> On 8/3/2010 2:45 AM, Leon Kolchinsky wrote:
> > Thanks for your help Rainer/Felix,
> >
> > I've tested several options including mod_substitute and mod_sed and it
> > seems that mod_substitute is a way to go.
>
> Yuk: why go through the kludge of re-writing the pages when simple
> configuration can make it so the pages are correct in the first place?
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkxZciMACgkQ9CaO5/Lv0PBqtQCgqVkecwM/GcfFnpZY4CeQ5M+g
> weIAnjBkSVjFNpyHaRJ6b58XRXjwIu41
> =x21u
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
Leon Kolchinsky
Senior Software Specialist (Collaborative Applications)
ITS Research Support Services
Monash e-Research Centre (MeRC)
Monash University
tel: +61 3 99059560

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message