apache/mod_jk on Ubuntu

17 views
Skip to first unread message

Hugo Ahlenius

unread,
Mar 14, 2017, 5:13:05 PM3/14/17
to mod_cfml
Hi,

I am setting up a new Ubuntu 16 server with Apache 2 and Tomcat 8/Lucee 5 using mod_cfml and mod_jk. It seems to me as if the apache module doesn't pass headers and trigger on requests that are forwarded to Tomcat that don't include ".cfm .cfc .cfml" (as specified in the CFMLHandlers parameter) - e.g. a request for http://mysite/ (that has an index.cfm file).

I have things set up and verified to work before applying mod_cfml using a hard-coded <host> in server.xml.

After I restart tomcat:
  • A first request to http://mysite/ returns stuff from the tomcat root context (a page "It works!")
    • I enabled logging in mod_cfml.conf, and it looks like it is not triggered - from the documentation "Default documents are also modified as a built-in function of mod_cfml."
  • After any request to http://mysite/ that includes something .cfm, e.g. http://mysite/index.cfm
    • I can see that the correct headers are passed
    • On the tomcat side/loggin I can see that the host context is created
    • The request resolves as expected
  • Since the host context is now created, a request http://mysite/ now resolves correctly

I tried some different combinations in CFMLHandlers, e.g. "*", "." and "/" but that didn't make any difference.


Any tips on how to resolve this?


Possible workarounds:

  • just move to mod_proxy, I don't have any strong feelings about mod_jk, it is just what I have been using before
  • disable the mod_cfml module in apache and add the required headers manually

Thanks!


Regards,

Hugo

Jordan Michaels

unread,
Mar 14, 2017, 5:25:08 PM3/14/17
to mod cfml
Hi Hugo,

Do you have "index.cfm" set in your DirectoryIndex value in Apache?

There's also a way to enable logging specifically for the apache module so it can tell you in detail what it adds headers to or not. Documentation is here:

http://www.modcfml.org/index.cfm/documentation/modcfml-so-apache-module/config-options/

--
Kind regards,
Jordan Michaels
Vivio Technologies

----- Original Message -----
From: "Hugo Ahlenius" <frax...@oxel.net>
To: "mod cfml" <mod_...@googlegroups.com>
Sent: Tuesday, March 14, 2017 12:03:10 AM
Subject: [mod_cfml] apache/mod_jk on Ubuntu

Hi,

I am setting up a new Ubuntu 16 server with Apache 2 and Tomcat 8/Lucee 5
using mod_cfml and mod_jk. It seems to me as if the apache module doesn't
pass headers and trigger on requests that are forwarded to Tomcat that
don't include ".cfm .cfc .cfml" (as specified in the CFMLHandlers
parameter) - e.g. a request for http://mysite/ (that has an index.cfm file).

I have things set up and verified to work before applying mod_cfml using a
hard-coded <host> in server.xml.

After I restart tomcat:

- A first request to http://mysite/ returns stuff from the tomcat root
context (a page "It works!")
- I enabled logging in mod_cfml.conf, and it looks like it is not
triggered - from the documentation "Default documents are also modified as
a built-in function of mod_cfml."
- After any request to http://mysite/ that includes something .cfm, e.g.
http://mysite/index.cfm
- I can see that the correct headers are passed
- On the tomcat side/loggin I can see that the host context is created
- The request resolves as expected
- Since the host context is now created, a request http://mysite/ now
resolves correctly

I tried some different combinations in CFMLHandlers, e.g. "*", "." and "/"
but that didn't make any difference.


Any tips on how to resolve this?


Possible workarounds:

- just move to mod_proxy, I don't have any strong feelings about mod_jk,
it is just what I have been using before
- disable the mod_cfml module in apache and add the required headers
manually

Thanks!


Regards,

Hugo

--
You received this message because you are subscribed to the Google Groups "mod_cfml" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod_cfml+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hugo Ahlenius

unread,
Mar 15, 2017, 3:38:41 AM3/15/17
to mod_...@googlegroups.com
Jordan Michaels wrote on 2017-03-14:
> Do you have "index.cfm" set in your DirectoryIndex value in Apache?

Yup, but that shouldn't matter, should it - the requested is passed to tomcat anyways for processing there, and it doesn't check that files exists. There is SES processing on the Lucee/Tomcat side.

> There's also a way to enable logging specifically for the apache module
> so it can tell you in detail what it adds headers to or not.

I tried that, and I can see that it works as its should for e.g. file.cfm requests.

What I ended up doing:
* I disabled mod_cfml in apache
* Added the following to my jk.conf
JkMountCopy All
JkMount /* ajp13_worker
SetEnvIf REQUEST_URI "\.(htm|html|css|gif|jpg|js|png|jpeg|xml|svg|zip|eot|ttf|otf|woff|hb)$" no-jk
<IfDefine !no-jk>
RequestHeader add X-Tomcat-DocRoot "%{DOCUMENT_ROOT}s"
RequestHeader add X-ModCFML-SharedKey "[mykey]"
RequestHeader add X-Webserver-Context "%{DOCUMENT_ROOT}s"
</IfDefine>

What it does is - set the no-jk variable for resources/files that should be served directly from apache, and pass everything else using jk to Tomcat, and add the required headers if no-jk is not defined.

Paul Klinkenberg

unread,
Mar 17, 2017, 6:41:58 AM3/17/17
to mod_...@googlegroups.com
Hi Hugo,

The message "It works" does not come from Tomcat, but from Apache httpd.

Also, you DO need to set index.cfm in the DirectoryIndex directive, otherwise it will not work.

Next to adding mod_cfml, you also need to set up JK or proxy in Apache, as you can read in the manuals at modcfml.org

I hope that helps.

Kind regards,

Paul Klinkenberg

Hugo Ahlenius

unread,
Mar 21, 2017, 3:25:04 AM3/21/17
to mod_...@googlegroups.com
Paul Klinkenberg wrote on 2017-03-17:
> The message "It works" does not come from Tomcat, but from Apache httpd.

Nope, that is the index.html from the ROOT context of Tomcat
"If you're seeing this page via a web browser, it means you've setup Tomcat successfully. Congratulations!"

> Also, you DO need to set index.cfm in the DirectoryIndex directive,
> otherwise it will not work.

Yes, and I had that set.

> Next to adding mod_cfml, you also need to set up JK or proxy in Apache,
> as you can read in the manuals at modcfml.org <http://modcfml.org>

Yup, and I had that set up and verified that things worked with manually inserted hosts context before I tried setting up mod_cfml

> Op 15 mrt. 2017, om 08:38 heeft Hugo Ahlenius <frax...@oxel.net
> <mailto:frax...@oxel.net> > het volgende geschreven:
Reply all
Reply to author
Forward
0 new messages