I’m totally confused. I’m setting up a fresh serv...
# box-products
p
I’m totally confused. I’m setting up a fresh server install on AWS. • Ubuntu 20. • Apache 2.4.41 Everything is coming up roses. I used Commandbox on the server directly to
coldbox create app name="myapp"
and no problems. I get the “Welcome to ColdBox!” screen and everything is fine. Now… I create the .htaccess file for the redirects based off this page and no pages will load. I get a 403 error on everything. I’ve tried setting permissions on the files… I’ve narrowed it down to one of these lines:
Copy code
RewriteRule ^$ /index.cfm?redirect_path=/ [QSA,NS]
RewriteRule ^(.*)$ /index.cfm?redirect_path=%{REQUEST_URI} [QSA,L,NS]
…in the .htaccess file, but I’m stuck resolving it. Commenting out these lines makes everything work again, but of course, the redirects do not. Does anyone have any insight here that could fix this?
Loaded Apache modules are: • core_module (static) • so_module (static) • watchdog_module (static) • http_module (static) • log_config_module (static) • logio_module (static) • version_module (static) • unixd_module (static) • access_compat_module (shared) • alias_module (shared) • auth_basic_module (shared) • authn_core_module (shared) • authn_file_module (shared) • authz_core_module (shared) • authz_host_module (shared) • authz_user_module (shared) • autoindex_module (shared) • deflate_module (shared) • dir_module (shared) • env_module (shared) • filter_module (shared) • headers_module (shared) • mime_module (shared) • mpm_event_module (shared) • negotiation_module (shared) • reqtimeout_module (shared) • rewrite_module (shared) • setenvif_module (shared) • socache_shmcb_module (shared) • ssl_module (shared) • status_module (shared) • jk_module (shared) …which are all default, but I added the rewrite and headers modules.
w
Yes. Something specific to apache and coldbox.
p
Any idea on how to fix it?
w
In apache some cgi var is not present which is needed for coldbox
Yes, but not at a computer right now
It is on my blog shiftinsert.nl just search for pathinfo
p
On it! Thank you! I’ll post an update here.
p
Unfortunately this isn’t resolving the problem. My .htaccess file looks like this:
Copy code
RewriteEngine on
RewriteRule ^$ /index.cfm?redirect_path=/ [QSA,NS]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.cfm?redirect_path=%{REQUEST_URI} [QSA,L,NS]
and I’ve created the
pathInfoProvider()
function in the /config/Router.cfc file and I’m still getting 403's.
w
I checked my setup and is exactly as described in this post. Not sure if things are different in other apache versions or other box versions, but the first thing you should do is check the value of cgi.path_info in your setup. If it is an empty string, this solution should work. and maybe reinit your coldbox framework or even restart lucee, although I am not even sure if that’s necessary.
p
To be clear, it’s ACF2018. I presume that doesn’t make a difference though.
w
Well, I was using lucee, so not sure if it is different. I would check this cgi value for sure, but I guess it shouldn’t be different. It is apache which is passing cgi vars to some java engine which executes lucee or acf. I would expect the cgi vars to be the same in both engines. But I am quite sure it is a problem with passing this path_info from apache to cfml. If you want to know what’s going on just have a look at the coldbox.system.web.services.RoutingService. For debugging you could dump there all values which are related to cgi, just in the facade method getCgiElement or getCleanedPaths() method. You could compare the apache setup with some local commandbox setup to see any differences. It took me quite some time to figure out what was wrong, and without the help of Pete Freitag I was probably still looking for a solution. Imho an nginx/commandbox setup is way more flexible, but we have to do it with this apache setup for this project.