Creating a Web Alias

Good morning,

What is the process to create a web alias similar to apache below?

Alias /folder “C:/path/to/folder”

Kind regards

–Mat

That sounds like a great feature request. I don’t think there is currently a way to do that. If you really want, you can set an Apache or Nginx reverse proxy in front of CommandBox to do that stuff.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Ok. Thank you for your response.

I should also add if you want to have an alias that points to a folder that’s already web accessible, you can do so with a rewrite rule.

http://ortus.gitbooks.io/commandbox-documentation/content/embedded_server/url_rewrites.html

Additionally, a linked folder on your file system will also allow you to pull in a folder from elsewhere on your hard drive.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

I know this is a really old thread, but it was marked as unread in my
inbox and I assume that's because I meant to answer it by saying that
this is actually possible already, and is a feature of RunWAR which was
added specifically to be able to mimic Apache without having to actually
install apache.

TL;DR: this is the argument to runwar:

-d,--dirs <path,path,...> List of external directories to serve from

So something like:

-d "C:/path/to/folder"

It doesn't have an alias, it just adds it to what's checked for content
when a request comes in. RunWAR accepts a server.json file for settings
like this, but I don't think we're using that aspect yet, so for now
you'd have to edit ServerService I believe.

-Denny

That’s a good start Denny. What would it take to go all the way with it and be able to specify an alias for a specific folder?

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

It would be relatively easy I think. What should the argument be named?
"aliases"? And how should we handle passing it? Just a comma
delimited list, or something like alias:dir, alias:dir, or maybe
something like [[alist,dir], [alias,dir]]?

It needs to work from the command line on *nix and windows, and it would
also be nice if it "jived" with json at the same time.

We just need to figure out good delimiters that won't mess up our
parsing and whatnot (like "alias=dir" could, for example), and I'm
spitballing here... easiest would be just a comma delimited list, but
that's kinda ugly, e.g. alias,dir,alias,dir,alias,dir... but maybe not.
Thoughts?

-Denny

Can we delimit the alias and path with a comma, and delimit each pair with a semi-colon?

–alias /foo,C:/foo;/bar,D:/bar

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Hrm, as long as we put it in quotes, otherwise linux will see that as an
end of command line delimiter.

We need to think about quoted paths, too, for both *nix and *doze, as
there may be spaces or special/funky chars and whatnot:

--alias "\"/foo\",\"C:/foo\";,\"... looks kinda... yeah, neh.

I'd be neat if there's an array-like syntax that's safe to use on the
cmdline across OSs, I know { is reserved in *nix, dunno how [ works offhand.

-Denny