Hoping that by chronicling my journey here, I may get helpful hints along the way, hereās where Iāve gotten so far.
The first step was relatively easy. I made a directory, cut/pasted the server.js
from the fastboot-app-server github site, and made a minimal package.json
that listed fastboot-app-server
as a dependency. A quick trip through yarn, editing the server.js to point it at my iis-dist
area (which is both a subdirectory of my project, parallel to dist, and a virtual directory under IIS), node server.js
and up she comes on http://localhost:4000
. Grand!
Looking at the results in the browser, I can see that the page is there but it is having trouble finding most of my assets - like CSS. Itās there, but ugly. The CSS files and images donāt worry me much, because the URLs will work fine when coming through IIS, but the config files do, as I want their contents in my shoebox. The sole objective of FastBoot is delivering that ready-to-rock index.html file. Hmmmā¦
The difficulty stems from rootURL
. My application is on an IIS site with ARR rewrites upstream. This means that URLs from the browser of the form:
http://mainsite/toolsprefix/{locale}/{toolname}
end up getting sent to
http://{toolname}-server/{locale}/{toolname}
When loading the site from the browser, supplying a rootURL
of /toolsprefix
and including {locale}/{toolname}
in the route so the client can use the locale, everything comes up fine.
However, running in localhost:4000 in the browser, FastBoot, which has picked up the rootUrl
from the build, canāt seem to find any of the collateral files on /toolsprefix/{locale}/{toolname}
. It wants them on /{locale}/{toolname}
. I tweak the ārootUrlā in the package.json
in the iis-dist
to /
, and everything comes up fine. However, this is not a sustainable solution.
Next problem: I add an ARR rule on the IIS server to rewrite incoming requests for /myprefix/{locale}/{toolname}
to the FastBoot server on port 4000. (Iām already using a rewrite for other resources to strip off the /myprefix
.) After a little tinkering with the rule, I now am able to navigate to http://myserver/myprefix/{locale}/{toolname}
. I can see FastBoot doing its work to deliver the index.html page and reporting it successfully read the configs, I can verify that the FastBoot page shows up in the browser with shoebox intact, and everything comes up, working beautifully.
Not bad for an early afternoon. Remaining interesting problems:
-
Setting up access during the build so that FastBoot can find everything it needs to create the index.html with the config resources in the shoebox, but direct access to all assets from the browser via IIS still works fine.
-
IIS will need a module that starts ānode server.jsā when the web app is started and stops it when the web app is stopped remotely from the IIS management console. I could perhaps try to use IISNode, but it seems like it will try to do things that fastboot-app-server is already doing, like making more servers.
Any insight on either of these will be appreciated.
When I get all this working and present it to folks on the ops team, there will inevitably be a whole slew of things to work out with the production infrastructure, CDN, caching, load balancing, etc., etc. But thatās fine. Iāll have something functioning that we can make better.