Monday, September 30, 2024

Mastering WebSockets with ColdFusion: Code Faster, Code Smarter

Thank you to everyone who attended my WebSockets presentation at the ColdFusion Summit. It was incredible to see such a full room and feel the excitement in the air. Your enthusiasm truly made the experience special, and it’s clear there is a strong interest in leveraging WebSockets with ColdFusion.

Unfortunately, I ran out of time before I could do the live demo section, which is always the highlight of the presentation. As promised, here is a video that covers everything I would have done in the live demo section of the presentation.

Below are links to the demo code and additional projects featured in the video, designed to help you get started with WebSockets in ColdFusion.

  • Presentation Slides
    The slides from my presentation, which provide an overview of WebSockets, their functionality in ColdFusion, practical tips, and key points to watch out for.
  • ColdFusion Summit 24 Demo Code
    This repository contains all the source code used in the demo, including setup instructions and example WebSocket interactions to help you get started.
  • AdvancedSocket
    A library designed to help maintain WebSocket subscriptions through various failure points, ensuring stable and reliable connections.
  • ColdFusion WebSockets Console
    A drop in console to assist in debugging and monitoring WebSocket activity.

I am sure I will have the opportunity to present this topic again, and I am considering splitting it into two sessions to cover the content more effectively. If that sounds appealing to you, please let me know by leaving a comment.

Your feedback would be greatly appreciated!

If you are interested in having me present this topic at your user group, feel free to contact me!

Saturday, July 20, 2024

Excited to Speak at Adobe ColdFusion Summit 2024 in Vegas!

I am thrilled to announce that I will be speaking at the Adobe ColdFusion Summit 2024 in Las Vegas! This year marks the 12th edition of the Summit, and I am honored to be part of it again!

This year, I am back to present on a topic that I am passionate about, WebSockets!

Mastering WebSockets with ColdFusion: Code Faster, Code Smarter

Fasten your seatbelts for a high-speed adventure into the electrifying world of WebSockets with ColdFusion! In this turbocharged session, you'll go from zero to hero, starting with the absolute essentials. Ever wondered what WebSockets are and why they're a game-changer in web development? Get ready to find out, and see them in action! We'll kick things off with a live coding journey, setting up and tearing apart a simple application, illuminating the path from initial handshake to full-fledged communication.

But we won't stop there! Once you've grasped the basics, we'll accelerate into advanced techniques that take your skills to the next level. Learn the secrets of sophisticated WebSocket design, master the art of stealthy debugging, and keep your connections alive and kicking, no matter what your app throws at them. With practical tips and a drop-in console for real-time troubleshooting, you'll be equipped to streamline your development and rocket your applications into the stratosphere.

This session is a fast-paced thrill ride designed for developers who are eager to elevate their ColdFusion applications with real-time capabilities. Ready to turbocharge your web development skills? Join me and unleash the power of real-time connectivity in your next project!

Registration

The Adobe ColdFusion Summit is not only filled with great content, but it is also an awesome opportunity to connect with fellow attendees, friends, community leaders and Adobe folks! All that for only $199, is quite a bargain and this year it's going to be located in a new venue, Resorts World in Vegas.

Make sure you register today for the Adobe ColdFusion Summit and be part of this experience.

Interested in getting certified?

The Summit offers the ability to get your Adobe ColdFusion Certification for an additional $199 which includes a one day workshop and exam after the conference.

Are you a student?

If you are an active adult student enrolled in higher education, then you can attend the Summit for Free! Talk about an offer you can't refuse! Way to go Adobe!

Tuesday, May 23, 2023

10 years of Into The Box!

Memories, connections, friendships, growth, and humbleness, are just a few of the words that come to mind when I think of Into The Box 2023.

Ortus has done it again, another year of giving back to the community and another conference that never disappoints. So, for those of you that have yet to make it to this conference, all I can say, is don't let another year go by that you do not join your fellow developers and peers in this intimate and, in my opinion, one of the best conferences you can ever attend for the ColdFusion community.

This year, I was honored to present "Building Human-Friendly Scheduled Tasks" with my dear friend Luis. He put me up to the challenge, and boy, was it one, but I am happy he did, as not only did I learn more about this topic, but at the same time, I committed updates to the framework and documentation. So, being known as the "WebSocket Guy," it looks like now I have been titled the "Scheduled Task Guy."

For those interested in my slide deck, it can be found here. I am still working on the UI I demoed in my presentation and hope to have a release to share with the community soon.

But enough about my presentation, as the experience was more than just that.

Instead of going down the roster of the speakers and their wonderful presentations, I encourage all to check them out at CFCASTS once they are made available.

For me, it was about the community. Starting at the speakers' dinner, where I sat next to Brian Klass, and we discussed technology, our love of food, and stories about our children. To discussing music with Saeed Bawaney and sharing photos of our newest guitars. Running into and catching up with Pete Freitag during a nice afternoon walk. Enjoying some great mariachi at Happy Box, and a funny adventure with Edgardo Cabezas. Getting to know Denard Springle and realizing we had a lot in common. And the list goes on and on.

The highlight, though, was dinner the last night with Brian, Nolan, Scott, and Chris. This one was special, and I am so grateful that it happened. Stepping outside of the boxes most of us live in on a day-to-day basis, it is great to know you are not alone in your struggles and doubts. I now know them all just a little better as they do me.

As you can see, this is just more than a simple conference. It is a place where new friendships are made, and old ones are nourished, and although this may be possible anywhere, there is something in the air when you come to an Into The Box conference that emphasizes it more.

Luis created something special at Ortus, and it is clear to see. To the entire Ortus team, I am grateful for everything you do.

To another ten years and more!

Friday, August 30, 2019

Working with FTP with TLS/SSL on ColdFusion

It appears that cfftp does not support connecting to a server using FTP with TLS/SSL, their secure connection only works if the server is setup as SFTP. So in order to hopefully help others, below is some example code of how you can do this easily on ColdFusion using Java's FTPSClient Class.

Tuesday, March 05, 2019

My ColdFusion 2016 to ColdFusion 2018 Upgrade

Well yesterday I finally decided to upgrade my production server from ColdFusion 2016 to ColdFusion 2018. I know I am a bit behind on this and those who know me, know I would have done this sooner, but honestly it has been hard to make the time. Anyways, I finally did it last night and this post is more about my experience and to give kudos for making this upgrade so pleasant.

MY SETUP

I know that not everyone's experience might be the same due to their setup / environment so to give some insight, this is how my production server was setup with ColdFusion 2016.
  • Windows Server 2016 - IIS 10
  • ColdFusion 2016 Enterprise w/ 2 instances
  • WebSockets via Proxy ( OF COURSE !!!! )
  • 2016 Auto Lock Down ( The Manual Process ... more on this later )
  • Fusion Reactor

UPGRADE STEPS

Now before I began, I did advise all my clients about the upgrade downtime and the possible bugs we might encounter after the update. Now on to my steps of how I executed this upgrade.
  1. Placed all sites on maintenance
  2. Removed all Connectors ( IIS and WebSockets )
  3. Stopped ColdFusion 2016 instances
  4. Removed instances from Fusion Reactor
  5. Installed ColdFusion 2018 and allowed it import the main instance settings.
    • Started 2018 and confirmed all settings
    • Downloaded and installed the latest update
    • After update shut down ColdFusion 2018
      The reason for this is that I wanted to use the same admin ports as 2016 was using, which is why I never had both on at the same time.
  6. Added 1st instance to Fusion Reactor
  7. Started both ColdFusion 2016 instances
    • Logged into 2nd instance and created an archive of the settings to import to new 2018 instance. I also went ahead and created an archive of the 1st instance's settings ( just in case )
    • Logged into 1st instance and removed 2nd instance ( handles windows service removal )
    • Shut down ColdFusion 2016
  8. Uninstalled ColdFusion 2016 ( bye bye old version )
  9. Started ColdFusion 2018
    • Created 2nd instance and started it
      * 1st hiccup here noted later
    • Imported settings archive to 2nd instance
    • Reviewed both instances and made sure datasources connections and mail settings worked
    • Added 2nd instance to Fusion Reactor
  10. Added all connectors ( IIS and WebSockets )
    * 2nd hiccup here noted later
  11. Ran Adobe's Server Auto Lockdown on both instances.
    OMG, talk about time saver!!!!!
  12. Removed sites from maintenance mode
  13. Tested all sites
  14. Upgrade Complete!!!!
I know that seems like a lot of steps but each one executed flawlessly and the only 2 problems I ran into where simple to fix. One of them was purely my fault due to my steps.

ISSUES ENCOUNTERED

  1. Second instance of ColdFusion 2018 would not start.
    To troubleshoot this I attempted to start the instance via the command prompt using the console output command and saw that it would not start due to the Fusion Reactor Instance settings in the jvm.config file which was copied over from the first instance. I removed the settings and the instance started up without an issue. This of course would have not happened if I would have added the instances to Fusion Reactor after installing the second instances.
  2. cfws Virtual Application created by the wsconfigproxy tool set the Application Pool to Default instead of the Application Pool of the site.
    This is one of those gotcha's that I have mentioned in my WebSockets presentation and although I had stated that in 2018 it no longer happens it appears it did, so always good to check.

ERRORS ENCOUNTERED

In regard to errors, the only one I ran into is actually embarrassing and a reminder of sometimes looking at old code hurts but it humbles us. A reminder that we all started the same and that we can all make simple mistakes.

It appears that in some places, yours truly did not add a proper space between a date and a time entry when executing createODBCDate and / or createODBCDateTime. Yup, sounds silly and some might complain that it should not error out because it worked before but hey when it is your fault own it and accept a stricter and better language.

In case you are wondering how I track errors....

I use to always send myself an email containing a dump of the error so I can debug. Then Google did this little thing where the CSS for the dump was stripped and it looked like crap ( yes it affected me ). I always wanted a better way of having a record of errors outside of my email box, and Google's change inspired me to think about creating my own solution but then I learned about Sentry. Sentry is great and they have a free version of their service which is very generous ( it is what I use ). If you do not have anything in place I recommend using it or giving a try. I have a CFC to integrate with on my GitHub which you can see and download @ https://github.com/GiancarloGomez/sentry-cfml.

SERVER LOCK DOWN AND PERFORMANCE MONITOR TOOLSET

I have to say that running the Server Auto Lock Down was the best experience overall. I had to run it twice due to having 2 instances and they each took a few minutes to run but it saved me HOURS!!!! Can I say that again ... "HOURS!!!!" They both executed without any errors!!!!

I also installed the Performance Monitor Toolset so I can play with and hopefully work with the Adobe team to see if we can get it to view and debug WebSockets connections and communications. If this does occur, you can expect it in my next WebSockets presentation.

CLOSING NOTES

Like stated before, this post was to outline my process and give kudos. Most of my steps where pretty straight forward to any upgrade I have done before but the Auto Lockdown Tool takes the cake!!!!

With that being said, I would like to give ...
KUDOS and a big THANK YOU to
Adobe's ColdFusion Team and Pete Freitag!!!!
We all know Pete is the main reason we have a Lock Down Guide and now this wonderful tool plus all the other things he already provides for the community.

Friday, October 12, 2018

ColdFusion Summit 2018

This year's the ColdFusion Summit was held at the Hard Rock Hotel in Las Vegas. At first I had my thoughts about it being off the strip but honestly I really loved the venue. I have attended this conference since the first one back in 2012 and have been honored to be a speaker since 2013. I have to say that this one was the best one yet!

The keynotes on day one and day two were fantastic, the sessions were great, the food was amazing and the party ... SPECTACULAR AND FUN!!!!

As always, I love this time of year as it allows me to network and catch up with old and new friends in the community.

To all those that attended my WebSockets presentation, you can find my slides and links to all the demo code in the following github repo.

https://github.com/GiancarloGomez/ColdFusion-Modern-uses-for-WebSockets

I am already looking forward to next year as I have great plans on expanding my sessions more and helping more developers understand the power and ease of using WebSockets.

Until next year!!!

Keep coding and learning ....

Tuesday, June 12, 2018

Clear your Netflix viewing history using JavaScript

If any of you have wanted to tried to clear some or all of your Netflix watch history, then you have most likely encountered the burden of clicking on a delete button over and over again. Well, if you rather do it in one little action try the following.

To begin do the following:
  1. Open Netflix in the browser of your choice.
  2. Hover over your profile picture in the upper-right corner of the screen.
  3. Click Account.
  4. Click Viewing Activity under My Profile.
WARNING:  You should understand JavaScript and what you are attempting to do before moving forward.

At the time of this writing, the following script will take any entry that is not from the current year and delete them from your watch history. You can choose to continue to scroll down the page before executing the following script in order to work thru your entire watch history. If you have a lot of entries, this will take a bit as each click that you are forcing is making an XHR.

Once you are ready to continue, simply open your web developer tools of your favorite modern browser and enter the following script in the console and execute.

UPDATE
Please run this with caution. At the moment, I was able to get rid of my pre 2018 entries but it appears I am getting a 403 response (forbidden) from Netflix on my browser and all my devices. There is a possibility that I got blocked. I will keep you all posted.

UPDATE 2
Netflix is working back to normal again but it was odd that a couple of friends and family members accounts worked and mine did not. I will assume that it was a safeguard that temporarily blocked my account due to the high amount of requests I made in a short amount of time. I know it was not my IP that was blocked as I tried to access from other devices outside of my network and it was still blocked. Maybe it was just some crazy coincidence and I sound insane. Regardless, I will still say, use with caution. In the end, it did what I wanted, cleared my viewing history since 2010 which was well over 2,600 individual clicks I was not wanting to do manually. Maybe in the future they will give an easier way to clear our entire viewing history or at least an easier way to bulk delete.

Friday, October 06, 2017

ColdFusion 2016, IIS 8.5, Skip IIS Custom Errors and 401 responses

Well I thought I would just put this quick thought out as it had me pulling my hair for a bit.

I developed an API for a client that when it fails authentication it returns a 401 and a JSON response in the body. In ColdFusion 11 I had no issues and then I just updated their staging server to ColdFusion 2016 and it started to return 401 without the response BODY ( sometimes it would and sometimes it would not ). This caused some issues with an app I am developing that uses this API and hence the hair pulling.

So, I decided to look at my connector and see it it was a setting I chose and it was, apparently clicking on Skip IIS Custom Errors causes this issue.

I have written about this before and recommended it (http://www.giancarlogomez.com/2016/05/coldfusion-10-iis-7-custom-errors-and.html) but now it appears I might revert back to the default setting (at least for this client ).

Now, after comparing the ColdFusion 11 install that I have still on production, it appears I have this setting set to false and on this upgrade I decided to set to true ( or click in the wsconfig GUI ). I don't know why I did this, maybe because I saw a checkbox for it and was like cool I will click it ( squirrel ).

So as a reminder to myself and hopefully to anyone else that might experience this issue, just set that setting to false and everything will go back to normal :-).



Tuesday, May 23, 2017

Invalid SSL on Chrome 58+ due to missing_subjectAltName

A friend of mine experienced this today and I referred him to a post that I used to fix the issue locally with my self-signed certificates when I first encountered it a month ago.

The author, Alexander Zeitler, goes thru the steps required to create your own CA (certificate authority) which is very handy when you want to just trust any certificate you create using it. Then he goes thru the steps for generating the SSL certificates using OpenSSL. In my own experience, I did not need the additional server config file he specifies, which I believe it was an issue with my version of OpenSSL but regardless it worked.

You can read thru the comments to find out more.

The link is :
https://alexanderzeitler.com/articles/Fixing-Chrome-missing_subjectAltName-selfsigned-cert-openssl/

He also wrote it on my birthday, so it was a nice gift. Thank you for sharing Alexander!

Wednesday, May 17, 2017

My Into The Box 2017 Experience

Well this is an overdue post that unfortunately work and personal things kept me from for a bit, but as promised I wanted to share my personal experience at Into the Box (ITB) this year. Also, why I feel it is one of the best, if not the best, ColdFusion conference I have ever attended.

I like others, have asked, “Why"? Why should I go to this gathering, isn't it just for users of ColdBox? Not, that I haven't used ColdBox, in fact I do and still support apps written in ColdBox. However, if I'm going to be honest, I am more of a Framework One kind of guy. So, before I go any further into my experience, let’s put that thought to rest.

Now, the keynote speakers presented a lot of great information geared towards ColdBox and their arsenal of tools. But, did you know, you do not have to use ColdBox to use them? Remember, as stated in their site, "ColdBox is an MVC framework for ColdFusion”, but the ColdBox Platform is so much more than that which include: WireBox, CacheBox, LogBox, TextBox, MockBox, ContentBox and CommandBox (which is my favorite). So, to answer the question, no you don’t have to use ColdBox MVC framework to attend, all you have to be is a ColdFusion developer that is interested in learning from and meeting peers in our community.

To start with my experience, from a personal stand point, this has been the best. Over the years of me working from home (although a blessing) I found myself becoming more of an introvert rather than the extrovert I was when I played music back in the day. This is something that I eventually break thru and once we start talking you might even wonder when was I ever shy, but I am. The setting for this particular conference was very different from others. From the moment I arrived thru the doors of the hotel and immediately introduced myself to Jorge Reyes and Bill Garoutte, it just felt different and very welcoming. The venue was just perfect and was intimate unlike the feeling I get from the conferences sponsored in Vegas. Please note, I hate Vegas and always have, from the days I attended Adobe MAX, Microsoft’s Connections to name a few and right from my first visit to the Magic Convention, which is not even a developer conference instead a retail industry convention. You may not share the same feeling for Vegas like I do which is perfectly fine as we are all entitled to our own opinion. At ITB, I found the intimacy and detail to personal connections to be extremely refreshing. We were more like a group of friends than strangers meeting in some large hall.

In regards to content. I found the information presented was truly amazing in how it was laid out and described. Going back to our first concern of, “Don’t I have to be a ColdBox user”, well you can say the proof is in the pudding. I would like to highlight some of my favorite moments but would first like to say I am grateful to every presenter that took time out of their busy schedules to share the knowledge they have with the rest of us. From Kevin Jones' presentations on NGINX, John Farrar’s on using Vue and introducing some modern development workflows, Mike Brunt’s on Tuning and Troubleshooting ColdFusion, Luis Majano’s on ORM, Brad Wood’s on CommandBox and introducing CFConfig (thank you), Charlie Aerhart’s on opening our eyes to what those damn spiders are doing to our servers and by far the one that blew my mind and inspired a CFC and a blog post to follow this was Gert Franz’s "How to make CFML script fast".

I can’t forget to mention the Happy Box Event featuring the Mariachi Band. This was the cherry on top, the moment I truly felt like I was part of a special group of people, a strong ColdFusion community and almost Family. Jorge, you sir have pipes, Luis you escaped your performance too quick, Brad and Gavin, next year the spotlight will be on you guys.

So, to close out this post, Into The Box was amazing. You can expect to see me at future ones and spreading the word. I can’t wait until next year and experience it all over again. To everyone at Ortus and anyone else involved, thank you for putting such a great event together.

Tuesday, May 02, 2017

On ColdFusion 10 ... Don't wait to upgrade anymore.

Just in case you are still on ColdFusion 10 and are contemplating upgrading, it appears that if you do not do it before May 31st, 2017 you will have to pay full price.

Don't take my word for it ...

Read it on their blog here

Wednesday, September 07, 2016

How to set up Facebook Login Deauthorize Callback with ColdFusion

Today, I continued my fun development on CrossTrackr with the Facebook Graph API as I had a few things to fix or update (to say the least). While doing this, I noticed that there was a callback for when a user deauthorized your app. Which currently on CrossTrackr, if a user did this and then tried to post, it would catch it and then just reset the user's settings. Although that worked, I wanted a better solution and this offered it by simply allowing me to complete the process on my end as soon as they executed the deauthorization.

In the most simple explanation, facebook simply sends a form post with a signed_request field value. You need to take this value and decode it properly so you can view the user_id, find in your system and then do what is necessary (depending on your implementation).

I could not find specific info on what was being returned on the Facebook developers portal (maybe because I did not look hard enough before googling) but lucky for us, there are many people out there that share their knowledge when they themselves figure it out, which is all I am doing here myself. The code that I have below is basically a port of a few PHP snippets and some other smart developers that were able to create an equivalent to PHP's hash_hmac.

I hope this helps you out if trying to do this on ColdFusion.

I'd like to thank the contributors of the following posts.

Facebook Deauthorize Function and Usage Example

Monday, September 05, 2016

Emoji support with ColdFusion and mySQL

So for a while, I have been trying to get Emoji support on CrossTrackr and no matter what I did I would still get an error until I finally threw my hands in the air and gave up. So what I ended up doing is using some code from this post on Drupal's blog, https://www.drupal.org/node/2043439, which allowed me to clean up the string before submitting to the database. When I found this post I was extremely happy but when I tried to execute the regex examples using reReplace() I would get the following ColdFusion error:

Malformed regular expression "/[\x{1F600}-\x{1F64F}]/".

This led to more frustration and then moving to my next solution which was to make a call to a PHP page using CFHTTP.

An example of how I did that can be seen in the following 2 gists.

ColdFusion Function making http call to local PHP File The local PHP File

Today I decided to attack this issue again as I got tired of getting errors, especially when I introduced new fields which I would forget to sanitize and users would try to use an emoticon 😫 . I found this great post (How to support full Unicode in MySQL databases) from Mathias Bynens @mathias which got me the answer I was looking for. See, I had already understood that I needed to set my fields to utf8mb4, but even though I did I would get the error, reason I went with just cleaning the string. In this post there is a section on modifying connection, client, and server character sets which was the piece I was missing. I just needed to set a couple of settings on mySQL server cnf file in order for data from ColdFusion to be able to be saved. Which are as follows:

The settings that actually did the trick where character-set-server which sets the default character set to use, character-set-client-handshake which ignores character set information sent from client and uses the server character set instead and collation-server which sets the default collation. The settings under the [mysql] and [client] parts did not really affect it working but I left them in regardless. I was previously using utf8 as the default and since utf8mb4 is fully backwards compatible with utf8, there was no data loss when I updated the columns. He does go into modifying the database, table and columns but when I tested, all I did was work with the columns that I needed to support and modifying the database or table itself was not necessary, thus not creating any issues with my index keys as he explains. An example of how I update the character set of a specific column is as follows:

ALTER TABLE `table_name` CHANGE `column_name` `column_name` TEXT CHARACTER SET utf8mb4;

Again, in his example he does a little more and sets the collation to utf8mb4_unicode_ci but after testing, the default collation for utf8mb4 also worked. Once I added the settings to mySQL and restarted and removed my cleanEmoji() wrappers in my ORM files, my saves no longer threw an error. One thing I did have to remove is surrounding my output with encodeForHTML() as that would replace the emojis with question marks.

Now in doing this today and finally getting it to work I did figure out something else, and that is that the call to PHP is not really necessary. We can use those regex patterns using Java's internal replaceAll() string function. So now I can wrap saves to fields where I do not support emoji's without incurring an http call from the server to itself and PHP handling the work for me. Below is the updated cleanEmoji(), which I now call cleanEmojiWithColdFusion().

I hope this helps you as it helped me get Emoji's (High Ascii Values) working on my App. I will try to see what is required if working with MS SQL and either update this post or create a new one.

Tuesday, May 24, 2016

ColdFusion 10+, IIS 7+, Custom Errors and a little thing called TrySkipIisCustomErrors

Today as I was debugging some issues that FuseGuard allowed me to see, it appeared that on my IIS Server my custom error page was being rendered after the IIS error page.

At first I was confused as I know I can control my 404 as I had set it properly in my Web.Config file as such:
<httpErrors existingResponse="Auto">
 <remove statusCode="404" subStatusCode="-1" />
 <error statusCode="404" path="/?action=main.404" responseMode="ExecuteURL" />
</httpErrors>
With the existingResponse attribute set to "Auto", it leaves the response untouched only if the SetStatus flag is set. Which I thought that meant as long as I set it in ColdFusion it would skip trying to show the IIS error page. Now, not to confuse further, the settings above worked for my 404s because I was removing how the server handled it and applying my own ExecuteURL setting. The issue was when i was trying to do a custom 503 (as FuseGuard shows when a request is blocked).

Now there is a value of PassThrough that can be set for existingResponse and it would work but the problem here is that if you have lets say a RewriteRule that blocks a request and sets it as a 503 nothing displays. So this was not going to work for me in that scenario.

More on IIS Custom Errors

Here is where TrySkipIisCustomErrors comes into play. Basically for existingResponse="Auto" to work properly we must be able to set Response. TrySkipIisCustomErrors to true but there is no way to do this in ColdFusion, trust me I tried hacking at it using getPageContext(). So then I started to google an alas there is a fix now for some of us.

While the solution can be found in either of the 2 following posts, you still have to search within the content to find it so I thought I would just show you and hopefully make future google searches a little easier.

http://blogs.coldfusion.com/post.cfm/onmissingtemplate
https://bugbase.adobe.com/index.cfm?event=bug&id=3982328

As of ColdFusion 10 Updater 18 and ColdFusion 11 Updater 7 there is a new setting that you can find in your isapi_redirect.properties file for your connector that is called iis_skip_custom_errors_enable which defaults to false. Go into that file or files (if more than one connector) and set it to true. Restart your IIS site (ColdFusion does not have to be restarted) and like magic it all works now.



To get a visual of what I am talking about below is a before and after of what my 503 page was coming up like.

BEFORE


AFTER


And since the setting is set to Auto, if nothing is set by ColdFusion, like one of my RewriteRules which blocks access to a certain directory, then the default IIS page is displayed as such.

Wednesday, May 11, 2016

ColdFusion 11 Update 8 is out now!

A new update is available for ColdFusion 11 which includes the following changes:

  • Tomcat upgrade to 7.0.68
  • Addresses a vulnerability mentioned in the security bulletin APSB 16-16.
  • Several important bug fixes for security, language, AJAX, and other features.

For me specifically, this fixes the CachedWithin bug with QueryExecute() where it ignored it.

All the bugs fixed can be found here.

ColdFusion 11 Update 8

Monday, May 09, 2016

ColdFusion IIS 10 HTTP/2 - Safari Bug

For a while I have been dealing with a bug that I had no idea how to even explain to the ColdFusion team and after telling them several times about it, nothing was ever resolved. Today though, I believe there is enough to show how and why this is occurring and only with Safari.

On Windows 10 running IIS 10, the HTTP/2 protocol is enabled by default and all you need to do to take advantage of it is have your site served over HTTPS. Believe it or not it is actually that simple.

The Bug
So when I would browse my site on any browser I would see that the connection was downgraded to http/1.1 which is absolutely ok and the site would still render, but when I would try it on Safari it would just go into an endless loop causing a lot of connections opening up on the server. I have to give it to Fusion-Reactor here because it was what allowed me to easily see this in action the first time.

Why it was a problem for me
Now any other day, because this is my dev box it would not matter but on this particular dev box, I needed to test a Cordova App I built that is pointing to a Webserver and although it worked on production when I pointed it to my dev box it would just never render. So I then tried to open in Safari on my desktop (because we know it is iOS Safari on the phone) to see what was going on and I would just get a white page, the spinning wheel and a lot of connections on ColdFusion.

I decided to finally open up my console (not web) and I started seeing the following:

Safari[2061]: tcp_connection_destination_handle_tls_close_notify 60 closing socket due to TLS CLOSE_NOTIFY alert
tcp_connection_tls_session_error_callback_imp 60


Those errors would just continue as long as I left Safari trying to connect. Once I stopped Safari, the messages would stop and Fusion-Reactor graphs would go back to normal. You can see all of this in the following video.


The temporary solution
So until either the Safari team or the ColdFusion team fixes this, the only solution is to disable HTTP/2 on Windows 10 which is easy by doing the following:

  1. Open the registry editor (regedit)
  2. Browse to Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters
  3. Enter 2 new DWORD Values EnableHttp2Cleartext and EnableHttp2Tls
  4. Set their values to 0
  5. Reboot


Now when you browse any HTTPS site running on IIS 10 it is server as HTTP/1.1, not causing the connection downgrade and therefore working properly in Safari.

Tuesday, January 12, 2016

ColdFusion WebSocket Proxy and IIS 8+ - 500 Error

Today I ran into an issue in my development environment that was one of those "Duh" moments. If you are using the WebSocket Proxy with IIS we already know the following is required.
  1. IIS 8+ with WebSockets Installed
    • Windows 8+ : Can be found in Control Panel > Programs and Features > Turn Windows Features on or Off > Internet Information Services > World Wide Web Services > Application Development Features > WebSocket Protocol (check it)
    • Windows Server 2012+ : Same as above but the steps are a few more screens. You may also start from the Server Manager (Top Right: Manage > Add Roles and Features)
  2. Run wsconfigproxy.exe (as administrator) which can be found in {{ColdFusionInstallDir}}/cfusion/bin/wsconfigproxy.exe
  3. Set "Use Proxy" in ColdFusion Administrator (restart may be required if not already set)
At this point everything should work without a problem and most of the times it does. I have ran into permission issues, especially when you go thru the lock down guide and you did not set the required permissions on the config/wsproxy directory. If all the above is correct and you still have an issue, like I did today, check one last thing.

Last time I configured the app pool on this app I was testing I had set the .NET CLR Version to "No Managed Code" and when the cfws directory was created it used the parent App Pool. The fix is simple, set the .NET CLR version back to a valid version or create another App Pool with a CLR assigned and bind it to the cfws folder since it is created as a virtual application. Below are some images that show the error I was receiving (after I allowed errors to show on localhost) and how to assign the fix. An easy way to test that they can be connected to is by browsing to the /cfws/ path of your domain. In an http call you should receive a good 200 response.

UPDATE
Do not use a different app pool, just ran into an issue that when I sent a call to WsPublish on the server side it messed with my Session scope. The only fix is to make sure they both use the same App Pool and that it is set to use a .NET CLR. (duh moment #2 of the day)

Bad Request

Causes Error Works Again


Good Request

Wednesday, December 23, 2015

FusionReactor Developer Edition!!!!

I can't express how valuable FusionReactor is for me daily and today on their Holiday mailer I noticed bullet item #8 which stated "Introduced a FusionReactor Developer Edition". This bullet item got my attention, because I have a Developer subscription that is normally available after you have 1 Production license which comes at a lower cost. So I was wondering why it was a bullet item on their newsletter.

This now goes to another reason why I love this company so much, not just because their product is great but because you can reach out to them and they respond almost immediately (we are across the pond from each other). So I reached out to David and he confirmed this was a different and less expensive version than I was currently paying for. Merry Christmas!!!!!!

So here is the low down on this version.
The initial cost for this version is ONLY $199, which includes your very own perpetual license and the first year of updates. Renewing for updates annually is only $99, but if you decide to not renew you still own your license.

This is really great for them to offer for us and the savings over what was previously available even for the developer based subscriptions is HUGE!!!

This company does offer a great product and if you are using it on a production server I would say pay for the correct license as the product pays for itself. 

David will be posting a blog entry soon regarding this edition, until then, you can purchase the developer edition by using the following link.


Keep Calm and Carry On Monitoring :-)
Thanks for the cup at the ColdFusion Summit this year!





Thursday, December 03, 2015

Why does my onError() fail on Request Timeout?

So I guess today has become a day of tuning some things that have always driven me crazy. One of them was that when an error would happen on one of my sites and it was based on a request timeout I would not get my nice little error notification and users or clients would send me a screenshot of an IIS error template with ColdFusion dumping its ugly error in their face. This has always been quite embarrassing for me but then I would get busy doing other things and forget about it.

So this is an example of what I am talking about ...



In validating that we can keep learning something new everyday, I had no idea that in an error I can go ahead and increase the timeout for that request, allowing just enough time for my onError() function to process.

I figured this out because I did an abort as the first line of my onError() function and the error page did not show up, letting me know that it did execute. I then tried to do a writeDump() and the ugly error showed its face again. I then decided to do a cfsetting, thinking it would fail and to my surprise that worked. At this point I was hardcoding a new requesttimeout but I wanted it to not fail even on pages that already had larger request time out settings.

I needed a way to increase my current timeout setting and apparently executing a createObject could also be done. Thanks to Brian Ghidinelli for this post from 2009 on how to get the current RequestTimeout.

So in the end I did the following and now I do get my nice error notifications and my users never see that ugly error page again!

Disclaimer : The code above is only supported on ColdFusion 11 + as cfsetting is not supported in cfscript prior. If your Application.cfc is written in tags then you should have no problem writing the equivalent and if it is in cfscript you can include a template (also works) that simply has the cfsetting in tag.

Also for anyone that may want to test this on their own code, you can add the following on any template to fire off the request timeout error

Those damn BOTS!

So the other day a friend of mine experienced a high amount of Sessions running on their ColdFusion Server. After some troubleshooting it appeared that the high traffic that was causing issues was based on bot activity. He started working on some ideas on how to handle this and contacted me, which then got me interested in doing something for my servers as well.

Others have blogged about this before and his implementation is based on one of Ben Nadel's post which you can see here.

Now, I am a little less lenient on the thought of bots than my friend so I said "Hey why not block them at the Web Server level before it even hits ColdFusion (or any other language)". So while I may opt to block all bots from a web app that I do not care for them to index, he did not quite feel the same. For a website I can see where you may need to be a little more flexible, so I created a set of rules to block most and allow a selected few in.

The rules below allow for bots from Apple, Google, Bing, Yahoo, and Duck Duck Go to pass GO and collect $200. I have included both for IIS URL Rewrite and Apache mod_rewrite.

IIS 7+ using URL Rewrite


Apache using mod_rewrite


But how about them Sessions? Alex, I'll take killing sessions for $400, please.

Well, now with the rules in place blocking bat bots and only allowing a few in, I decided to run a function at onRequestEnd() that takes advantage of a new function since ColdFusion 10 called sessionInvalidate(). Thanks Charlie Arehart for reminding me of it while having a nice discussion on this topic this past CFSummit. As you can see below it is a simple reFindNoCase() on the same expression I used to allow bots in as defined in the RewriteRules.

ColdFusion 10+

I tested this using my trusty Fusion Reactor and seeing the session count go up 1 and back down 1 immediately was great, gratifying and ultimately validated my logic!

Please note, this will not change your CFID, CFTOKEN or JSESSIONID values, it simply kills the session each time. If you want new values, then you would need to do sessionRotate() as well but I did not see the need for it since as it will be only execute by bots. Also, if you are using J2EE Session Variables and want its ID reset, you will need to execute getPageContext().getSession().invalidate().

If you do have to support ColdFusion 9 or less, or some other ColdFusion engine, you can use something like Ben's solution and apply the logic to overwrite the SessionTimeout value.

Incidentally, my friend set the SessionTimeout to equal a function which then returned the TimeSpan based on his validations, rather than wrapping his validation around the settings like Ben did. I was originally worried about rewriting the SessionTimeout setting per request (which they both do), which is the reason why I opted for my way instead.

If you need to support another language, you can simply use the rules I have provided and based on how the language you are working with handles sessions, you can create a solution. Hope this helps some of you out, I know for me I rest a little better at night knowing that bots are not causing havoc on my apps and/or sites.