Here are some options, sorted by, in my opinion, the more viable and easy solutions first:
1. Use subdomains, as Alex proposed No modification to the source files, which means it could be easily updated when you vendor updates it. 2. Add an HTML "base" element<https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base>to the "head" element of all HTML files You'll need to apply this method to all HTML files, you can create a simple middleware to get the job done. 3. Re-write all URLs If all urls are not relative and start with a known string, you can simply create a *middleware* to rewrite the prefix of those URLs. It does mean you may have to apply such a middleware to not only the HTML files, but to CSS, JS and other assets. (probably all non-binary files.) Finally, if you're going to create a middleware to accomplish #2 or #3, you'll need to create a Transform stream<http://nodejs.org/api/stream.html#stream_class_stream_transform> and use either string replacement or a DOM/HTML/XML parser to manipulate the content. Some packages I use that could be helpful to you: * Stream helpers: through <https://npmjs.org/package/through> or through2<https://npmjs.org/package/through2> are very simple and useful * HTML/DOM helper: cheerio <https://npmjs.org/package/cheerio> is very simple and useful as well. If you know jQuery, you'll be all set :-) On Fri, Feb 7, 2014 at 12:38 AM, Alex Kocharin <a...@kocharin.ru> wrote: > > If your vendor documentation uses relative links, it should work as is. > But I guess it's not the case. > > I'd suggest to place it on a subdomain instead. > > > 07.02.2014, 09:24, "ming" <hseum...@gmail.com>: > > Hi, > A few days back we received vendor FOO's documentation in electronic > format and we put the document root at > /path/to/vendor/FOO/doc/root > > With node-static and the usual: > var static = require('node-static'); > var file = new static.Server('/path/to/vendor/FOO/doc/root'); > ... > we quickly managed to serve the documentation up via node-static in no > time. > > i've also been running a reverse proxy with http-proxy which requires > client-side X.509 authentication. Now i'm asked to explore the > possibility to serve the vendor documentation through my reverse proxy and > the URL proposed to arrive at the document root of FOO is something like: > https://proxyHost:proxyPort/vendor/FOO > > With node-static and node-proxy in the picture, i can't think of an easy > way to achieve that unless i add the path prefix "/vendor/FOO" to all the > paths in the files in > /path/to/vendor/FOO/doc/root > which is quite traumatic. Is there a better (hopefully much better) and > less fragile way to achieve that? > > Thanks. > > > -- > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to nodejs@googlegroups.com > To unsubscribe from this group, send email to > nodejs+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to nodejs+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > -- > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to nodejs@googlegroups.com > To unsubscribe from this group, send email to > nodejs+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to nodejs+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.