Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@bennadel
Created November 27, 2019 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bennadel/5caedc52b05d397ed97fe5fd7772487b to your computer and use it in GitHub Desktop.
Save bennadel/5caedc52b05d397ed97fe5fd7772487b to your computer and use it in GitHub Desktop.
Fixing Connection Failure: Unable To Determine MIME Type Errors With sslCertificateInstall() In Lucee CFML 5.3.3.62
<cfscript>
// This is the local development environment that we'll be hitting via CFHTTP.
domain = "projects.local.invisionapp.com";
// Examine the collection of SSL Certificates installed on THIS server for the given
// target domain.
for ( cert in sslCertificateList( domain ) ) {
dump( cert );
}
</cfscript>
<cfscript>
// This is the local development environment that we'll be hitting via CFHTTP.
domain = "projects.local.invisionapp.com";
// ------------------------------------------------------------------------------- //
// ------------------------------------------------------------------------------- //
// When this "traffic simulator" starts to run, the HTTP service won't be able to
// contact the local development environment since it uses a self-signed certificate.
// As such, if this is the first run of the traffic simulator, let's install the SSL
// certificate that is being used by the local development server.
if ( isNull( url.startedAt ) ) {
sslCertificateInstall( domain );
}
// ------------------------------------------------------------------------------- //
// ------------------------------------------------------------------------------- //
// At this point, we should be OK to start making HTTP requests.
// --
// NOTE: I am NOT trying to create load-test here. I'm only trying to create a steady
// stream of traffic so that I can test some New Relic metrics locally. As such, it
// doesn't matter that any one request here will block the next one.
for ( i = 0 ; i < 10 ; i++ ) {
trafficRequest = new Http(
method = "GET",
url = "https://#domain#/d/ben/default"
);
trafficResult = trafficRequest.send().getPrefix();
echo( trafficResult.fileContent & "<br />" );
cfflush( interval = 1 );
sleep( randRange( 10, 50 ) );
}
</cfscript>
<cfoutput>
<script type="text/javascript">
// Refresh the page for the next batch of simulated traffic requests.
window.location.href = "#cgi.script_name#?startedAt=#getTickCount()#";
</script>
</cfoutput>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment