Skip to main content
rprossor
Participant
November 24, 2017
Question

IIS outbound url rewrite

  • November 24, 2017
  • 4 replies
  • 2240 views

is it possible to set up Outbound url rewrite rules using Coldfusion and IIS?

If if anyone has this working, please point me to an example,

i have no no problem with IIS and .net or html pages but when I try .cfm either the server hangs or the outbound rules only work with the target page.

no issues with inbound rewrite

regards

Richard

    This topic has been closed for replies.

    4 replies

    rprossor
    rprossorAuthor
    Participant
    November 29, 2017

    I have the outbound rule partially working. It rewrites the target but never finishes loading. This then has knock on effects elsewhere. I have a CFC which works when rule disabled but reports err_incomplete_chunked_encoding when I enable it. Does this point to a solution for anyone?

    regards

    richard

    James Moberg
    Inspiring
    November 24, 2017

    We've needed to do this in the past, but we didn't do it using IIS Rewrites. (NOTE: We use IISWebSpeed to perform many post-CF optimizations.)

    We use getPageContext().getCFOutput().getBuffer() to capture the output buffer.  To change URLs, correct some third-party HTML and relocate desired CSS/JS to the footer (based on inline attributes), We use jSoup to remove/append/modify the HTML before delivering the HTML content to IIS.  (We've had to increase the buffer size and this method doesn't work if some content has already been flushed.)

    Community Expert
    November 24, 2017

    I don't know if you can use IIS's rewrite mechanism for this. But you can use CF to do this yourself, using the onRequest method in Application.cfc. You can use this to rewrite practically anything that is part of the response. This can impose significant overhead if you're not careful, though.

    Dave Watts, Eidolon LLC
    Inspiring
    November 24, 2017

    What are you trying to do with the rules?

    What rules are you using?

    Without more information, its hard to say what the issue is.

    I have had no issues with outbound rewrite rules so its likely an issue with your rule or IIS setup.

    What version of IIS and CF?

    Have you looked at any logs or tried Failed Request Tracing?

    Participating Frequently
    November 27, 2017

    I am using CF11 and IIS 7. Outbound rule created by User Friendly template in IIS is:

                   <rule name="OutboundRewriteUserFriendlyURL1" preCondition="ResponseIsHtml1" enabled="false">

                        <match filterByTags="A, Form, Img" pattern="^(.*/)catalog/catalog_item_page\.cfm\?style_code=([^=&]+)&(?:amp;)?style_name=([^=&]+)&(?:amp;)?category=([^=&]+)$" />

                        <action type="Rewrite" value="{R:1}{R:2}/{R:3}/{R:4}/" />

                    </rule>

    We are replacing our website with a new one and wish to set up friendly urls and also reroute links from the old site to the new.

    I will have a look at trace logs

    Thanks for your help

    Regards

    Richard

    Participant
    November 30, 2017

    I’ve done this before but its more of a hybrid with IIS rules and catching them as variables through application.cfc. It also uses extensionless urls. Can also use CF and error catching to act as a programatic redirect hub for all URL paths. What works for you really depends on use cases and the flexibility you need down the road.