Due to certain restrictions, I need to host my application from a subdirectory (e.g. hostname.domain.com/mysailsapp). The webserver is nginx and set to proxy connections to sails/node.
The issue I'm facing is that grunt automatically builds in the links to include frontend javascript/css/images/etc, but the entire sails app is expecting to be at the root level.
Everything works fine when I connect directly to sails via port 1337 as sails is at the root, but when connecting though the subdirectory URL proxied to sails this will not work.
I didn't see an easy way to configure sails to change this behavior and did not want to manually update the grunt build path.
Maybe I'm missing something else, but wanted to open this up on SO to see if there was another way or if I should open up a issue for sails to include such a configuration option.
Edit: Accessing via http://host.domain.com:1337/, the HTML source includes links like this:
<!--STYLES-->
<link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap-theme.css">
<link rel="stylesheet" href="/bower_components/font-awesome/css/font-awesome.css">
<!--STYLES END-->
These links work fine since you can access hosted from sails/node. http://host.domain.com:1337/bower_components/bootstrap/dist/css/bootstrap.css - Returns 200
Hosting the sails app from an nginx proxy, http://host1.domain.com/mysailsapp/, the sails/nginx return this HTML to the browser:
<!--STYLES-->
<link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap-theme.css">
<link rel="stylesheet" href="/bower_components/font-awesome/css/font-awesome.css">
<!--STYLES END-->
The browser then attempts to load the static assets via: http://host1.domain.com/bower_components/bootstrap/dist/css/bootstrap.css
This link will not work since the browser is attempting to load the static assets outside of the sub directory.