Note: This blog post is from 2006. Some content, links and indeed comments from others may be outdated--though not necessarily. Corrections are welcome, in the comments. I may revise the content if necessary.Have you ever needed to know programmatically what IP addresses, besides localhost, ARE allowed to access your Developer Edition of ColdFusion? I'll show you how here.
The message above does show the allowed IP addresses, but what if you need that list programmatically for any reason? Since I couldn't find it discussed anywhere, and I discovered the feature today, I just figured I'd share it in case it helps anyone searching in the future.
Along the way, I also explain for any who need to know, both what the "allowed IPs" limits are and how they've changed in 5, 6, and 7, as well as how to reset the allowed IP addresses.
Most folks know that the Developer Edition of ColdFusion is intended for just local (as opposed to production) development. But to be specific, it's limited not JUST to requests from your localhost but both localhost and 1 other IP address (in CFMX 6 or 6.1), or localhost and 2 other IP addresses in CFMX 7.
Once that limit is reached, if you or anyone else tries to access a CF page from an IP address other than localhost or that 1 (in 6/6.1, or 2 in 7) permitted to that point, the user will get a message:
A License Exception has been thrown.
You tried to access the developer edition from a disallowed IP (nnn.nnn.nnn.nnn). The developer edition can only be accessed from 127.0.0.1 and two additional IP addresses. The additional IP addresses are: yyy.yyy.yyy.yyy,zzz.zzz.zzz.zzz
Of course, in a real message the nnn, yyy, and zzz would be real numbers, and in CFMX 6/6.1 it would list only "one additional IP address".
But the key point for the purpose of this blog entry is that the end of the message lists the IP address(es) that have "gotten in", such that any requests from other IP addresses will fail to run and will get the error message.
So it's sometimes useful to know the list of allowed IP addresses, but what if you need to access it programmatically? And how do you reset it to allow other IP addresses to get in?
Accessing that List of Allowed IP Addresses Programmatically
If you have need to know the list of allowed IP address(es) programmatically for any reason, the following code using the undocumented and unsupported ServiceFactory will show it:
Unfortunately, there is no equaivalent to this in CF Admin API (in CF 7 or 8).
Resetting the Allowed IP Address(es)
Finally, some have wondered how they can reset the list of permitted IP addresses. Just as in CF5 (where you could access the developer edition from any 1 IP address, either localhost or another), in CFMX 6.1 and 7 you just need to restart the server. That will clear the list of allowed addresses.
In CFMX 6.0, however, you needed to actually edit a license.properties file while the server was stopped (as I blogged about back in 2002. Thankfully, that was fixed in 6.1.
For more information on that, as well as for a documented reference of the localhost/localhost+1 licensing in CF 4.5/5/6.0/6.1, see http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_17832.
For documented reference to the localhost+2 support in CF 7, see the bottom of the table at http://www.adobe.com/products/coldfusion/productinfo/product_editions/#s2.
Of course, the error message itself also clearly explains it in CFMX 6 and 7.
For more like this: