http://coldfusion.com logo
#cfml-general
Title
# cfml-general
a

asishd

05/23/2022, 3:22 PM
Hi, Anyone using commandbox's ad-hoc coldfusion 2018 server for running development application in Intel Mac os? I am unable to set “Access-Control-Allow-Credentials” to “true” in server.json file. I have tried using set() and header() in rules section. I am afraid I am not setting it correctly using the function. Any help regarding this is much appreciated.
b

bdw429s

05/23/2022, 5:34 PM
Hi @asishd • Please use threads • Please don't cross-post the same question in more than one place https://community.ortussolutions.com/t/unable-to-set-access-control-allow-credentials-using-server-json/9253
👍 1
j

jumpmaster

05/23/2022, 6:18 PM
I don't use it often, but cfheder has always worked for me. I occasionally use commandbox on my mac. I usually just use Lucee, but it seems like acf supports this from the docs. https://cfdocs.org/cfheader
b

bdw429s

05/23/2022, 6:22 PM
@jumpmaster FWIW, the CommandBox server rules (which are powered by Undertow's predicate language) apply to all requests including static files such as JS or images, whereas a
cfheader
tag can only run on a request for a
.cfm
or
.cfc
page.
BTW, the fix was resolved in the original linked Ortus Community post above.
j

jumpmaster

05/23/2022, 6:33 PM
@bdw429s didn't read through the linked post, thought I would offer an alternative. Guess it wasn't needed
b

bdw429s

05/23/2022, 6:34 PM
It's fine to use cfheader, but I wouldn't do it manually, there are modules that handle all this for you https://www.forgebox.io/view/cors
j

jumpmaster

05/24/2022, 1:31 PM
@bdw429s first, my mind is a little blown right now. I can't believe I have not heard of forgebox before. Going to be playing with that for the foreseeable future. Second, I use CFWheels at work, which handles cors for us, but when I've messed around with lucee w/out a framework I've always used cfheader within Application.cfc if I need to handle certain requests differently. The link provided seems to depend on coldbox? So in that case would you still not recommend using cfheader this way? Sorry for bugging you. I know there is potentially a lot to unpack there, but I'm curious.
b

bdw429s

05/24/2022, 4:29 PM
I can't believe I have not heard of forgebox before.
@jumpmaster I can't believe you haven't either. ForgeBox has been around since probably 2010 🙂 I would recommend taking a good look at the entire Ortus suite of modern CFML tooling, which revolves around • ColdBox MVC • ForgeBox.io package repository • CommandBox CLI
The link provided seems to depend on coldbox?
Yep, ColdBox was the first framework in CF to really be modular and as such, it's the only framework that's really built up a huge collection of drop-in functionality.
So in that case would you still not recommend using cfheader this way
Well, what I'd really recommend is using a modern framework when writing CFML code so you don't have to go and re-invent the wheel over again 😉
4 Views