When using Commandbox, I’m struggling with getting...
# box-products
d
When using Commandbox, I’m struggling with getting my alias to work. I don’t know if it’s a concept issue I’m struggling with or if I’m trying to make it do something it isn’t supposed to do. I have the webroot on my local c: drive and trying to include a repository of files available for users to download. I don’t want the files as part of the code base so I have it on my d: drive. I thought I could setup an alias:
server set web.aliases./guides = d:\\guides
For a test case, I added a dummy image to the d:\guides\image1.jpg and then in my cfm code, I have <img src=“/guides/image1.jpg”> but the image is returning as a broken link. For grins, I move the d:\guides folder to the webroot, updated the server set statement, restarted commandbox but I’m still getting a broken image.
b
@Daryl Lackey That looks right, but I'd need more debugging information
When you hit the image directly in your browser, what response do you get?
Also, what is in the server's console logs?
Have you tried a
--debug
start? A
--trace
start?
d
Hitting the image directly (with the guides under the webroot) returns Not Found (not a 404 but an actual ‘not found’ message.
b
Also FWIW, back slashes will be escaped for the JSON file, but don't need to be escaped in the
server set
command. I always just use forward slashes anyway .
d
I have not tried --debug or a --trace
the double slash was a typo in the channel, not the code but good catch.
the server.json has it escaped correctly
I restarted box with --debug but not sure what i’m looking for
b
Restarted
box
or the serve? 🤔
d
sorry, server
I just ran your exact same command on a server and the alias works correctly
Copy code
<https://127.0.0.1/guides/test.txt>
is serving files from
Copy code
D:/guides/
If I do a
Copy code
start --debug --console
I see the following
Copy code
--dirs /guides=D:\guides\
...
Copy code
[DEBUG] Runwar: Initialized MappedResourceManager - base: C:\Users\Brad\Desktop\sandbox\pfxtest, web-inf: C:\Users\Brad\.CommandBox\server\CB2A1DFFA4F612E8127F0A5AFF97300F-pfxtest\lucee-5.3.9.160\WEB-INF, aliases: {/guides=D:\guides}
...
Copy code
[DEBUG] requested: '<https://127.0.0.1/guides/test.txt>'
d
Okay then something is off with my server.json I suspect. Thanks for confirming. Between stopping my server and now, the URL being opened is no longer the same. It was opening my https://mysite-dev.com (local host file) but now box is opening https://127.0.0.1:443/
b
There is more debugging we can enable, but I'd start out and see if you see those matching lines
I would guess you're in the wrong folder
Do you have bullet train installed?
d
ugggg… you are right!
b
message has been deleted
d
I don’t have bullet train installed.
b
☝️ Bullet train is a prompt replacement that makes it easy to tell what folder you're in
Lesson learned 😉
d
I forgot I spun up another instance to debug some code and didn’t navigate out of it.
b
Copy code
install commandbox-bullet-train
d
on it
🙂
b
And don't forget to install the powerline patched font so you get the cool triangle chars https://www.forgebox.io/view/commandbox-bullet-train
My fav is
Just configure your terminal to use it
d
Looks like bullet train is blocked here at work. I’ll have to install it this evening.
Looks like I messed up my local server.json file in my directory mix up. Ugggg. I’ll have to fix that after lunch. Thanks for the help, again.
b
@Daryl Lackey Interesting-- how exactly is it blocked?
Is the entire ForgeBox.io site blocked?
I think the download itself comes from S3, but surely that's not blocked too!