Most sites like App Engine and Heroku have the URL like this:
https://my-app-name.herokuapp.com/foo
Rather than this:
https://herokuapp.com/my-app-name/foo
I'm wondering (a) why this is, and (b), if there is a way to support the latter. It seems that GitHub does this with your projects in a repo with gh-pages. For example, from what I remember, given a repo like this:
https://github.com/myuser/myrepo
I can add a CNAME record to my repo, do some configuration on my DNS provider/manager elsewhere, and end up with a custom domain such as:
myrepodomain.com
My question is this. If it's possible in some way to configure a server or system such that you map the apps to a path rather than a subdomain, so foo.com/myapp
rather than myapp.foo.com
, such that you can then take that sub-path and map it to a custom domain like GitHub seemingly does in my example. If it's not possible, I'm wondering why not. I have a faint sense that cookies and session might be a problem in one case over another, or that SEO might be a problem, but maybe there are solutions.
Essentially I would like to do:
https://foo.com/app1/some/path
https://foo.com/app2/another/path
https://foo.com/app...
And then for the ones that want a custom domain, I map them to whatever they want:
https://foo.com/app1 -> helloworld.com
https://foo.com/app2 -> foobar.com
Wondering if that's at all possible, and if so, roughly how it's done.