Hi,

On Friday, November 10, 2017 at 12:07:56 AM UTC+1, Kyle Hall wrote:
>
>
> In order to view the application off our VPN, we set up an Apache proxy to 
> our public-facing test URL: http://www.testdomain.com/calendar. The 
> application runs, but none of our CSS or JS files show up. They are all 
> 404ing in the debugging console, showing up as 
> http://www.testdomain.com/css/layout.css instead of 
> http://www.testdomain.com/calendar/css/layout.css.
>
> We've found that if we add /calendar to the CSS and JS paths in the 
> layout.jade file, it works. But we're wondering if there is a way to set up 
> our Apache proxy so that it only proxies the front-end pages and not the 
> internal CSS and JS folders. The other problem is that we also have JS 
> files at the root of our application, so we would likely have to proxy 
> ignore those files individually as well.
>
 
Well, there are a few things. One, you would be much better off if you 
serve the assets directly by apache. Say your static stuff is in your 
*/var/app/public/assets/{css/img/js}* directory - you would tell your proxy 
(in this case apache) to serve any of the */calendar/assets/** requests 
directly from there. That way you offload serving static files from your 
app server (Node).

The other thing is to setup static route differently - e.g. you probably 
have somewhere in your code a line like this: *app.use('/assets', 
express.static(__dirname + '/public/assets'));* Now, what you do there is 
say *app.use('/calendar/assets', express.static(...));*. The first solution 
is much better because your node app will always work on */ *path if served 
standalone (like when you're working on the app), and your proxy can pick 
and choose on which virtual directory you serve from (e.g. if you want to 
change /calendar to /cal, or even serve from both, your app developers 
don't need to know about this at all, the ops guy sets it up as he wants 
it).

 

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/923634b1-c60a-4b4d-9ae0-db40208bbcc8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to