Skip to main content
Todd in Italy
Inspiring
July 2, 2024
Question

ColdFusion 2021 tasks: how to run as https?

  • July 2, 2024
  • 1 reply
  • 968 views

Greetings,

I have not been able to find instructions on this, nor am I able to get it to work by trial and error. Currently I have 20 or so scheduled tasks that run in the ColdFusion 2021 Scheduled tasks manager as http://localhost....task.cfm format. I need them to run as https instead due to regulations where I work which disallows ALL http, even to localhost. Can anyone direct me to instructions on how to get this to work? I tried simply changing the url to https://localhost and https://ip and https://sitename but none of them execute properly. Also, when I try to run the same tasks via the command line using cf.bat, they error out, unable to find the variables such as the mail server specificed in the task. These tasks all run fine when submitted as http requests via the scheduler. Any guidance would be appreciated.

    This topic has been closed for replies.

    1 reply

    Charlie Arehart
    Community Expert
    Community Expert
    July 2, 2024

    Todd, the solution lies in configuring https support in the web server serving the pages. 

     

    So if you're forming those urls without any port at the end, it's typically your "external web server" that's handling those (like iis or apache, or perhaps even nginx). If instead , your urls end with a port number like 8500, that would be the "internal" or "built-in" web server in cf (technically in tomcat) handling them. 

     

    (That's a generalization, if course. Things can be configured anyway one wants in regard to ports and domain names.) 

     

    So you'll want to look into configuring whichever web server is serving your requests. And since you don't name any port in your examples (and they "work" if called via http://), I'll assume you're using an external web server. And each of those (iis, apache, nginx, etc) have their own ways to configure https support. Which are you using? 

     

    And in setting up such https support for such a web server you'd also need to implement at least one server certificate, whether that's a self-signed one, one paid for from a cert vendor, or one implemented for free using let's encrypt, for example. Each of those is their own realm of discovery for you to choose among. 

     

    So no, I'm not offering here EXACTLY what you need to do--as those steps will vary based on your setup among the various options above. But this points you in a starting direction, and if you clarify your web server setup and familiarity with things, that can guide us to recommend more specific steps. 

     

    (One last point: when testing things in this regard--about using http/https or specifying ports--note that you can test things in your browser rather than only as a scheduled task, t+which can simplify your initial testing. That said, it's often best to test from a web browser ON THE SERVER if possible, for various reasons, to more closely mimic how CF would call the url from that server.) 

    /Charlie (troubleshooter, carehart. org)
    Todd in Italy
    Inspiring
    July 2, 2024

    Hi Charlie,

    Thanks for the response. I would guess that coldfusion tasks have to be run in the context of the internal web server, which in this case is Apache Tomcat. The admin page runs at the default 8500, assuming internally on the included tomcat. I do not know how to get the internal web server to accept tasks on a different port, nor how to bind the server certificate to whatever port is used, and I was unable to find instructions on it. I don't have a lot of experience configuring tomcat. I am sure there is a conf or xml somewhere that needs to be edited, and some way to bind the existing server certificiate. I just can't find it. Do you know where to find that document?

    I do all my testing on the server itself via web browser. For the scheduled tasks, I just copy them into the address bar and hit enter. Http runs, https does not. 

    TG

    Charlie Arehart
    Community Expert
    Community Expert
    July 2, 2024

    Todd, please re-read what I wrote. If your current urls (called as tasks) do NOT use a port, then you are almost assuredly running them NOT via ColdFusion's/Tomcat's web server but instead IIS (if on windows). As you note, it's not obvious how to change the Tomcat web server to listen on another port, let alone support different domain names or ip's, so I doubt you've done that. 

     

    So again, focus on setting up IIS (or whatever is your "real" web server, serving the called pages) to support https. It has nothing to do with CF at all, in that case (even if the cf admin itself Is running on the built-in xf/tomcat web server). 

     

    And if you're not sure whether it's really iis serving the called task requests, stop iis and request the task's url in the browser. If it fails with iis stopped, then clearly iis is serving that url.

     

    And don't worry if this all feels confusing or overwhelming. It's just part of the process of becoming familiar with the many moving parts and how to configure them. And because there can be different ways people do or want to have things configured, that's why there's no single answer that works for anyone trying to accomplish this task. That also would explain why you've found little on "how to do it".

     

    Again, once you clarify your setup, I or others will be able to offer more specifics.

     

    But if indeed it's iis you're using, you can find many resources (unrelated to cf) talking about how to configure iis sites for https support, including that need to setup a server cert for the web server to use. 

    /Charlie (troubleshooter, carehart. org)