|
27 | 27 | <cfif structKeyExists(url, "furl") AND url.furl EQ "/pingFU"> |
28 | 28 | <cfcontent type="text/plain" variable="#ToBinary( ToBase64('PING FU SUCCESS') )#" reset="Yes"> |
29 | 29 | </cfif> |
30 | | - |
31 | | - |
| 30 | + |
| 31 | + <!--- healthcheck live endpoint ---> |
| 32 | + <cfif structKeyExists(url, "furl") AND url.furl eq "/healthcheck/live"> |
| 33 | + <cfset healthcheckLive()> |
| 34 | + </cfif> |
| 35 | + |
| 36 | + |
32 | 37 | <!--- run the active project's constructor ---> |
33 | 38 | <cfset this.projectConstructorLocation = getProjectConstructorLocation(plugin="webtop") /> |
34 | 39 | <cfinclude template="#this.projectConstructorLocation#" /> |
|
114 | 119 | <cfparam name="cookie.hasSessionScope" default="false" /> |
115 | 120 |
|
116 | 121 | <cfif NOT isBoolean(cookie.sessionScopeTested)> |
117 | | - <cfset cookie.sessionScopeTested = false> |
| 122 | + <cfcookie name="sessionScopeTested" value="false" expires="never" httpOnly="true" /> |
118 | 123 | </cfif> |
119 | 124 |
|
120 | 125 | <cfif NOT isBoolean(cookie.hasSessionScope)> |
121 | | - <cfset cookie.hasSessionScope = false> |
| 126 | + <cfcookie name="hasSessionScope" value="false" httpOnly="true"> |
122 | 127 | </cfif> |
123 | 128 |
|
124 | 129 | <cfif not len(cgi.http_user_agent) or (cookie.sessionScopeTested and not cookie.hasSessionScope) or reFindAny(this.botAgents,lcase(cgi.HTTP_USER_AGENT)) or arrayFind(this.botIPs,cgi.remote_addr)> |
|
127 | 132 |
|
128 | 133 | <cfif not cookie.sessionScopeTested> |
129 | 134 | <cftry> |
130 | | - <cfcookie name="sessionScopeTested" value="true" expires="never" /> |
131 | | - <cfcookie name="hasSessionScope" value="false" expires="never" /> |
| 135 | + <cfcookie name="sessionScopeTested" value="true" expires="never" httpOnly="true" /> |
| 136 | + <cfcookie name="hasSessionScope" value="false" expires="never" httpOnly="true" /> |
132 | 137 | <cfcatch></cfcatch> |
133 | 138 | </cftry> |
134 | 139 | </cfif> |
|
137 | 142 |
|
138 | 143 | <cfif not cookie.sessionScopeTested><!--- Sessions are OK for this user, set the cookie ---> |
139 | 144 | <cftry> |
140 | | - <cfcookie name="sessionScopeTested" value="true" expires="never" /> |
141 | | - <cfcookie name="hasSessionScope" value="true" expires="never" /> |
| 145 | + <cfcookie name="sessionScopeTested" value="true" expires="never" httpOnly="true" /> |
| 146 | + <cfcookie name="hasSessionScope" value="true" expires="never" httpOnly="true" /> |
142 | 147 | <cfcatch></cfcatch> |
143 | 148 | </cftry> |
144 | 149 | </cfif> |
|
246 | 251 |
|
247 | 252 | <cfreturn false /> |
248 | 253 | </cffunction> |
249 | | - |
250 | | - |
| 254 | + |
| 255 | + |
| 256 | + <cffunction name="healthcheckReady" output="false"> |
| 257 | + <!--- |
| 258 | + readiness indicates that the application has been initialised and is ready to handle requests |
| 259 | + (e.g. ready to be brought into a load balancer) |
| 260 | + ---> |
| 261 | + <!--- test the application ---> |
| 262 | + <cfif NOT structKeyExists(application, "bInit") OR application.bInit eq false> |
| 263 | + <cfheader statuscode="503" statustext="Unavailable: Application has not started"> |
| 264 | + <cfabort> |
| 265 | + </cfif> |
| 266 | + |
| 267 | + <!--- return a 200 OK ---> |
| 268 | + <cfheader statuscode="200" statustext="OK"> |
| 269 | + <cfabort> |
| 270 | + </cffunction> |
| 271 | + |
| 272 | + <cffunction name="healthcheckLive" output="false"> |
| 273 | + <!--- |
| 274 | + liveness indicates that the application is in a healthy, live state (and the JVM is healthy) |
| 275 | + failing this test means that the application server may need to be restarted |
| 276 | + ---> |
| 277 | + <!--- return a 200 OK ---> |
| 278 | + <cfheader statuscode="200" statustext="OK"> |
| 279 | + <cfabort> |
| 280 | + </cffunction> |
| 281 | + |
| 282 | + |
251 | 283 | <cffunction name="OnApplicationStart" access="public" returntype="boolean" output="false" hint="Fires when the application is first created."> |
252 | 284 |
|
253 | 285 | <cfset var qServerSpecific = queryNew("blah") /> |
|
420 | 452 | <cffunction name="OnRequestStart" access="public" returntype="boolean" output="false" hint="Fires at first part of page processing."> |
421 | 453 | <cfargument name="TargetPage" type="string" required="true" /> |
422 | 454 |
|
| 455 | + <!--- healthcheck ready endpoint ---> |
| 456 | + <cfif structKeyExists(url, "furl") AND url.furl eq "/healthcheck/ready"> |
| 457 | + <cfset healthcheckReady()> |
| 458 | + </cfif> |
| 459 | + |
| 460 | + <!--- block requests to /farcry paths with the exception of webtop ---> |
| 461 | + <cfif left(cgi.script_name, 7) eq "/farcry" AND NOT left(cgi.script_name, len(application.url.webtop)) eq application.url.webtop> |
| 462 | + <cfset oError = createobject("component","farcry.core.packages.lib.error") /> |
| 463 | + <cfset oError.showErrorPage("404 Page missing",oError.create404Error("Bad request")) /> |
| 464 | + <cfabort /> |
| 465 | + </cfif> |
| 466 | + |
423 | 467 | <!--- If a session switch was requested, do that now ---> |
424 | 468 | <cfif structKeyExists(url, "switchsession")> |
425 | 469 | <cfset application.fc.lib.session.switchSession(url.switchsession) /> |
|
462 | 506 | <cfif not listcontains(server.stFarcryProjects[application.projectDirectoryName].domains,cgi.http_host)> |
463 | 507 | <cfset server.stFarcryProjects[application.projectDirectoryName].domains = listappend(server.stFarcryProjects[application.projectDirectoryName].domains,cgi.http_host) /> |
464 | 508 | </cfif> |
465 | | - <cfset cookie.currentFarcryProject = application.projectDirectoryName /> |
| 509 | + <cfcookie name="currentFarcryProject" value="#application.projectDirectoryName#" httpOnly="true"> |
466 | 510 |
|
467 | 511 | <!--- Checks to see if the user has attempted to flick over to administrate a different project on this server. ---> |
468 | 512 | <cfif structKeyExists(url, "farcryProject") |
|
535 | 579 | <cfset var oError = "" /> |
536 | 580 |
|
537 | 581 | <!--- increase the request timeout a little, in case the error was caused by a request timeout ---> |
538 | | - <cfif structkeyexists(server,"railo")> |
| 582 | + <cfif structkeyexists(server,"lucee")> |
| 583 | + <cfsetting requesttimeout="#getPageContext().getRequestTimeout() + 10000#" /> |
| 584 | + <cfelseif structkeyexists(server,"railo")> |
539 | 585 | <cfsetting requesttimeout="#getPageContext().getRequestTimeout() + 10000#" /> |
540 | 586 | <cfelseif structkeyexists(server,"coldfusion")> |
541 | 587 | <cfsetting requesttimeout="#CreateObject("java", "coldfusion.runtime.RequestMonitor").GetRequestTimeout() + 10#" /> |
|
756 | 802 | <!--- If all else fails... ---> |
757 | 803 | <!--- 1. See if the user has a cookie telling us what project to look at. ---> |
758 | 804 | <cfif structKeyExists(url, "farcryProject") AND len(url.farcryProject)> |
759 | | - <cfset cookie.currentFarcryProject = url.farcryProject /> |
| 805 | + <cfcookie name="currentFarcryProject" value="#url.farcryProject#" httpOnly="true"> |
760 | 806 | </cfif> |
761 | 807 | <cfif arguments.plugin EQ "webtop" AND structKeyExists(cookie, "currentFarcryProject")> |
762 | 808 | <cfif fileExists(expandPath("/#currentFarcryProject#/farcryConstructor.#arguments.fileExtension#"))> |
|
0 commit comments