[Looking for Charlie's main web site?]

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:

<cfobject action="CREATE" type="JAVA" class="coldfusion.server.ServiceFactory" name="ServiceFactory">

<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?
  • 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
Comments
Thanks for posting this. I did not know the CF 7 allowed 2 ip addresses and how to reset the allowed IP addresses. Since the Developer Edition on my localhost is also my testing/preview box that is helpful. I often need my boss or others to look at something before I post it to our public webserver.

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.
# Posted By Bruce | 12/14/06 3:10 PM
Thanks. As for your hope, well, indeed the very reason they require a restart is that otherwise it would be too easy for one to abuse the "free license". It is a "developer" edition, not a "testing" edition. We really should be grateful (as I can tell you are) that they upped it to localhost+2.

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. :-)
Ths worked perfectly. Thank you for posting this.
Happy to help. Always glad to hear when something may have, so thanks for sharing.
Is there any way to change the "allowed" ip addresses in CF8?
Thank you so much for your help.
Jacques, do you mean programmatically or in the Admin? In the Admin, there's a "debugging ip addresses" page to do it. And programmatically, at least since CF7 you can do it with the Admin API. Check out the CF docs (not the reference but the user guide or the Admin/config guide) for more on how to use the Admin API.
# Posted By charlie arehart | 1/7/10 4:49 PM
Can you use a dyndns.org domain name instead of an IP address?
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?
# Posted By scott conklin | 1/25/10 11:32 AM
@Scott, the interface allows only IP addresses. You raise an interesting problem, and I would suggest you raise it as a feature request:

http://www.carehart....
Thanks
# Posted By Deep | 12/7/10 10:41 AM
Just a follow-up to this post, now 8 years later: CF10 and above has changed the whole mechanism and done away with this problem. Now, the Dev edition no longer limits requests to 2 ip addresses. Instead, it lets as many in but it limits requests to 5 concurrent requests at most at one time. That's a really nice improvement (that many have missed)!
Charlie, Do you know where in the Coldfusion 10+ filesystem to add allowed IP addresses?
# Posted By MadameSol | 9/9/16 1:26 PM
MadameSol, I suspect you didn't read my last comment here before asking. :-) It explains why there is no such file, because there is no longer any such limit. As you may be reading this reply in your email client, the link to the comment is:

http://www.carehart....

Does that answer your question, and any confusion you may have had in trying to find any such file? :-)
An update on this post (from 2006): things have changed in CF10 and above. Now it's no longer that "only 2 other IPs can ever make requests, until a CF restart". Instead, it's that "only 2 other IPs can make *concurrent* requests".

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.
Copyright ©2024 Charlie Arehart
Carehart Logo
BlogCFC was created by Raymond Camden. This blog is running version 5.005.
(Want to validate the html in this page?)

Managed Hosting Services provided by
Managed Dedicated Hosting