[coldbox-3.5.2] Strange Redirect Error

I know I likely messed something up…but here’s the problem. As many of you know, this is a big SaaS project I’m still struggling with…the struggle is how to organize it and many of you have had some great suggestions…even solutions that worked for you…some have worked for me but aren’t the solution for the project, other ideas have come really close. Though I have not settled on this…I’m really excited about created a “naked” application and sharing a directory of core code (virutally) with it…then I change the externallocations and internal conventions.

In principle, this works, as long as I’m re-initing the framework. I’ve created several test sites all using this structure and they all work…but only when the framework is reinitted.

As soon as I DON’T reinit, I get an inifinite loop/redirect error and the site won’t come up…and I cannot figure out why. I have deleted just about everything in the individual sites so that only “core” code should work…but alas nothing. Chrome reports:

This webpage has a redirect loop

I have no idea what’s happening…but know I definitely don’t want to abandon this style of solution as I think it will best serve the client.

Has anyone using this technique perhaps seen something similar?

Mike Craig

One of the most common redirect loops is when you have error handling that displays a layout!

For example the application throws an error, you capture it with a an interceptor or other method and run a handler to display the error in a layout of your site. If this error is in your application, it will create an endless loop.

It is times like this you need to do line breaking, or look at learning line debugging as it will help you find where it is happening.

Another time this can happen is when you secure pages, and keep redirecting to a secure page.

So, I started from scratch with a new fresh site. Runs by itself happily. Then, I shared a symbolic link to the root of my “shared” site code…ran just fine but of course, nothing was pointing to that directory. Here is where the problems started happening.

In this organizational structure, the “main” site (the domain the user will request content from) should, when first launched, get is “core” configuration from the shared content site, then override or add to that configuration as needed…to accomplish this, I extend coldbox.cfc from “core.config.coldbox” and, using it’s own configure() method, I super.configure() to get the global settings, then override what I need to. Without overriding anything, the “main” site now gives me an error that it is in some redirect loop error. When I reinit the framework in the URL, it works, but when I don’t, it fails with this error.

To test this further, I simply copied the “core” coldbox configuration cfc to the “main” site instead (not extending anything) and everything works the way I expect it to.

I don’t think this makes sense, but just because I think that does not mean there is not something I’m doing wrong or some reason this is not working. I’ve been trying to figure out what in that scenario would cause an infinite loop of redirection. This is particularly baffling because, if I’m understanding correctly, coldbox.configure() should ONLY be called once on application start (or fwreinit=1)…So I’m lost.

Now that does not mean to suggest I can’t work with this…I just need to be able to pull out the “global” configuration settings and put them somewhere else that I can just include in my “main” coldbox.cfc…which should work…though, that’s the poor mans version of inheriting.