Programmatically accessing allowed IP Addresses in Developer Edition (and understanding the limits)
Note: This blog post is from 2006. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as 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.
Background
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:
<cfoutput>#ServiceFactory.LicenseService.getAllowedIp()#</cfoutput>
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 content like this from Charlie Arehart:Need more help with problems?
- Signup to get his blog posts by email:
- Follow his blog RSS feed
- View the rest of his blog posts
- View his blog posts on the Adobe CF portal
- If you may prefer direct help, rather than digging around here/elsewhere or via comments, he can help via his online consulting services
- See that page for more on how he can help a) over the web, safely and securely, b) usually very quickly, c) teaching you along the way, and d) with satisfaction guaranteed
I do wish there was a way to reset the allowed IP addresses in CF 7 without having to restart the server. But since the Developer Edition is free, I can't complain too much.
Some may know that there was a "devnet" edition that one could subscribe to in the CFMX 6.1 timeframe. That program is no more, which may explain why they bumped up the +1 to +2. Still, this free edition is NOT that testing edition. Sure, many will complain that this is CF's achilles heel, that there ought to be an edition better suited to central testing (at a cost, if not free), and others will argue that there should be an entirely free edition for production use.
Let me just head that off here, should anyone feel motivated to respond, by saying that I DO NOT want this entry to become a place where that subject is debated. It's been covered (and surely will continue to be covered) in plenty of other places. Discussing it here will serve no value, so I'd ask it be refrained from. This is not directed at you, Bruce, but rather at those who might read your and my comments and feel motivated to press the subject. :-)
Thank you so much for your help.
in other words, how do you inform CF that the 2 IP addresses you wish to use for the 2 remote developers are Dynamic and ever-changing without constantly having to restart the service when they change. i want to use my dns name instead, is this possible?
http://www.carehart....
http://www.carehart....
Does that answer your question, and any confusion you may have had in trying to find any such file? :-)
In other words, in CF9 and earlier, once 2 other IP addresses made requests against your CF developer edition, no other IPs could every make requests until CF was restarted.
In CF10 and above, instead, requests can be accepted from ANY IP addresses, but the "limiter" is that if requests from 2 IPs are already running, then any requests from any other IPs will be rejected (with an error similar to the above), at least until there are NOT concurrent requests from 2 or more IPs.
(Note that this is different from what Adobe announced with CF10, as I indicated in an update I offered in the post above. I'm hoping to find when things changed, either at initial release or per some update of 10. But I have confirmed things work as I say in this comment in the current CF10, 11, and 2016 that I have.)
Also, a request against localhost is always permitted.
I'll do an updated blog post at some point with more details/clarifications.