I have two sites running on a Win 2022/IIS server. Both have separate app pools/directories/web contexts . The code and folder structure is exactly the same with the exception of the root Application.cfc file. This file has one difference which is the application name. site one has and site two has . When I access site one “acportal” everything works great when logging in. All sessions that get set during authentication get maintained. If I try to access the second site “acportalDEV” the site sessions are not stored below the root folder.
If I restart Lucee on the server whatever site gets access first “acportal” or acportalDEV" works with sessions and the second one does not work. It will flip flop after a lucee restart.
I’ve been migrating from ACF to Lucee for about 6 months and so far just some code updates and we’ve been good! Feel like I am missing something simple here. Thanks in advance for any direction!
Here is the application.cfc code:
<cfcomponent>
<!--- set up the app info --->
<cfset this.name = "acportal">
<cfset this.applicationTimeout = createtimespan(0, 8, 0, 0)>
<cfset this.sessionManagement = "YES">
<cfset this.sessionTimeout = createtimespan(0, 1, 0, 0)>
<cfset this.setClientCookies = "YES">
<cfset this.scriptProtect = "All">
<cfset this.mappings["/rooty"] = getDirectoryFromPath(getCurrentTemplatePath()) />
<!--- Set page request settings. --->
<cfsetting requesttimeout="60"
showdebugoutput="true"
enablecfoutputonly="false" />
<!--- Session Scope - Fires when the application is first created --->
<cffunction name="OnApplicationStart" access="public" returntype="boolean" output="false">
<!--- dsn info --->
<cfset application.acglobaldsn = "acglobal">
<cfset application.acdwdsn = "acdw">
<cfset application.accos = "accos">
<!--- user content upload directory --->
<cfset thisPath = expandPath("/") >
<cfset ProfilePhotosFolder = "assets\global\profile_photos\">
<cfset TempPhotosFolder = "assets\global\temp_photos\">
<cfset application.ProfileUploadDir = "#thisPath##ProfilePhotosFolder#">
<cfset application.TempUploadDir = "#thisPath##TempPhotosFolder#">
<cfreturn true />
</cffunction>
<!--- Session Scope - Fires when the session is first created --->
<cffunction name="onSessionStart" returntype="void" output="no">
<cfif not isdefined("cookie.CFID") and isdefined("session.CFID") and isdefined("session.CFToken")>
<cflock scope="session" type="readonly" timeout="5">
<!--- store the ID/Token so that we don't lose them. --->
<cfcookie name="CFID" value="#session.CFID#" secure="Yes" httpOnly="true">
<cfcookie name="CFToken" value="#session.CFToken#" secure="Yes" httpOnly="true">
</cflock>
</cfif>
</cffunction>
<!--- On Request Scope - Fires at first part of page processing --->
<cffunction name="onRequestStart" access="public" output="false">
<cfargument name="template" type="string" required="yes">
<!--- Log out code --->
<cfif structkeyexists(#url#, "logout")>
<cfset structClear(session) />
</cfif>
<!--- On Error Scope - Fires when an exception occures that is not caught by a try/catch --->
<cffunction name="OnError" access="public" returntype="void" output="true">
<cfargument name="Exception" type="any" required="true" />
<cfargument name="EventName" type="string" required="false" default=""/>
<!--- Log all errors in the DB. --->
<cfquery name="inserterror" datasource="#application.acglobaldsn#">
INSERT INTO tbl_log_error (page, type, message, detail)
VALUES( <cfqueryparam value="#listlast(cgi.script_name,"/")#" cfsqltype='CF_SQL_VARCHAR'>,
<cfqueryparam value="#Arguments.Exception.type#" cfsqltype='CF_SQL_VARCHAR'>,
<cfqueryparam value="#Arguments.Exception.message#" cfsqltype='CF_SQL_CLOB'>,
<cfif ISDEFINED("Arguments.Exception.detail")><cfqueryparam value="#Arguments.Exception.detail#" cfsqltype='CF_SQL_CLOB'><cfelse>'none'</cfif>)
</cfquery>
<!--- display non error code --->
<cfdump var="#exception#">
</cffunction>
</cfcomponent>
Don’t forget to tell us about your stack!
OS: Windows Server 2022 (Running IIS)
Java Version: 11.0.20.1 (Eclipse Adoptium) 64bit
Tomcat Version: 9.0.80
Lucee Version: 6.0.0.585