Simon Baynes: Web Development

Default Proxy for ColdFusion

Ever had to develop an application that used cfhttp? Ever done this on a machine that is behind a proxy?

If the answer to those two questions is yes then you may have written some bung code like this:-

<cftry>
    <cfhttp url="http://www.simonbaynes.com/rss.cfm" proxyserver="255.255.255.255" port="80" throwonerror="true" />

    <!--- if there is an error then we are on live --->
    <cfcatch type="any">
        <cfhttp url="http://www.simonbaynes.com/rss.cfm" throwonerror="true" />
    </cfcatch>
</cftry>

This is totally unnecessary as with some jvm.config arguments you can set a default proxy for your ColdFusion instance.

-DproxySet=true -Dhttp.proxyHost=255.255.255.255 -DproxyPort=80#
By Simon Baynes