Copy link to clipboard
Copied
We are running Windows Server 2008 with IIS 7 and ColdFusion Server Standard 8,0,1,195765.
There are certain directories where we want to process htm files through ColdFusion, but most htm files should be processes through the ServerSideIncludeModule.
I modified the web.xml file as such:
<servlet-mapping id="coldfusion_mapping_15">
<servlet-name>CfmServlet</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<servlet-mapping id="coldfusion_mapping_16">
<servlet-name>CfmServlet</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<servlet-mapping id="coldfusion_mapping_17">
<servlet-name>CfmServlet</servlet-name>
<url-pattern>*.htm/*</url-pattern>
</servlet-mapping>
<servlet-mapping id="coldfusion_mapping_18">
<servlet-name>CfmServlet</servlet-name>
<url-pattern>*.html/*</url-pattern>
</servlet-mapping>
But now, ALL htm files on the site are processed through ColdFusion, even when no directory level mappings have been created for it. Even when I explicitely create an HTM mapping for a directory and set the extension to process through serverSideIncludeModule, it still processes through ColdFusion. The directory level settings appear to be ignored.
I navigate to a directory in the IIS Manager, click on Handler Mappings, add a new Module Mapping for HTM as such:
Request Path: *.htm
Module: ServerSideIncludeModule
Name: SSI-Inc
Request Restrictions: File
Verbs: Post, GET
This appeared to be the correct method for setting this up but it does not work.
Any insight on correct configuration of this feature would be most helpful.
Thanks,
Jim
Copy link to clipboard
Copied
I can appreciate your challenge, Jaymes. I've not done too much with the idea of overriding what filetypes CF handles. It's something that people do pretty rarely, so may not be well understood by most. Perhaps others here will chime in with more experience. (But I know you're right to need to update the web.xml, as well.)
My guess would be that the problem is wildcard mapping in IIS (in IIS 7, it's the handler mapping for path "*"; in IIS 6 it's indicated in a separate field on the page for entering extension mappings). This is put there by CF's installer (or the CF web server config tool) in each site configured for CF, or all sites if you tell CF to do that. In IIS 6, at least, you'll see it in handler mappings page in the properties for the root "web sites". I've not found a corresponding one in IIS 7. Instead, I think it's just put in each site if you told CF to have all sites processed via CF.
Anyway, that's what catches things first, sending the request to the CF/jrun web server connector, and that web.xml then controls if CF says "I do or don't handle those".
Here's a possibility: you can re-order those mappings (in IIS). Maybe if you put your "other" mappings above the "*" one, that will cause it to handle things first, and not CF. Give it a shot and let us know. In IIS 7, choose the "view ordered list" on the right, and then note that the new display offers a "move up/down" action on the right. (In IIS 6, there seems no way to order to things. I think that's what the separate wildcard field was for, to say "do this first before the others", I'm not sure how this would have been handled there. I'm sure others do.)
All that said, you can't remove the wildcard mapping.
Let us know if this helps.
/charlie
Copy link to clipboard
Copied
I think I have this working now. I tried re-ordering and a lot of other stuff, but none of that worked.
What I did was explicitly define the directories in the web.xml file that I want to process html as cfm.
<servlet-mapping>
<servlet-name>CfmServlet</servlet-name>
<url-pattern>/moc/*.html</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>CfmServlet</servlet-name>
<url-pattern>/moc/*.htm/*</url-pattern>
</servlet-mapping>
This restricts the coldfusion processing to only those directories which I specify.
To get serverSideIncludeModule to work for all other htm files, I defined the handler at the web site level in IIS manager.
Since I only have a few directories that need to process htm as cfm this solution seems acceptable, easy to understand, and easy to implement.
If I run in to any issues related to this solution I will re-post.
Thanks,
Jim
============
Copy link to clipboard
Copied
Good stuff. Thanks for updating us.
/charlie