{"action":"created","issue":{"url":"https://api.github.com/repos/balderdashy/sails/issues/3534","labels_url":"https://api.github.com/repos/balderdashy/sails/issues/3534/labels{/name}","comments_url":"https://api.github.com/repos/balderdashy/sails/issues/3534/comments","events_url":"https://api.github.com/repos/balderdashy/sails/issues/3534/events","html_url":"https://github.com/balderdashy/sails/issues/3534","id":129785781,"number":3534,"title":"Change path to static files on layout file","user":{"login":"jasalazar","id":8170705,"avatar_url":"https://avatars.githubusercontent.com/u/8170705?v=3","gravatar_id":"","url":"https://api.github.com/users/jasalazar","html_url":"https://github.com/jasalazar","followers_url":"https://api.github.com/users/jasalazar/followers","following_url":"https://api.github.com/users/jasalazar/following{/other_user}","gists_url":"https://api.github.com/users/jasalazar/gists{/gist_id}","starred_url":"https://api.github.com/users/jasalazar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasalazar/subscriptions","organizations_url":"https://api.github.com/users/jasalazar/orgs","repos_url":"https://api.github.com/users/jasalazar/repos","events_url":"https://api.github.com/users/jasalazar/events{/privacy}","received_events_url":"https://api.github.com/users/jasalazar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-29T14:47:55Z","updated_at":"2016-01-31T20:31:46Z","closed_at":null,"body":"Good morning everyone.\r\n\r\nI realized that when my layout file includes CSS and JS files this way:\r\n\r\n`<link rel=\"stylesheet\" href=\"/styles/bootstrap.css\">`\r\n`<script src=\"/js/jquery-1.11.3.min.js\"></script>`\r\n\r\nThey are not rendered when using them behind Nginx as a proxy.\r\n\r\nBut when i edit the injection in my layout file this way:\r\n\r\n`<link rel=\"stylesheet\" href=\"/assets/styles/bootstrap.css\">`\r\n`<script src=\"/assets/js/jquery-1.11.3.min.js\"></script>`\r\n\r\nThey are properly rendered.\r\n\r\nI've tried several options in my Nginx server configuration file to render CSS and JS files, but it wont work.\r\n\r\nMy question is: Can i edit the path that will be shown in my layout file to become like this?:\r\n\r\n`<link rel=\"stylesheet\" href=\"/assets/styles/bootstrap.css\">`\r\n`<script src=\"/assets/js/jquery-1.11.3.min.js\"></script>`\r\n\r\nIf so: Where?\r\n\r\nPS: It works either way while running my app only on lifting sails server.\r\n\r\nThanks a lot!"},"comment":{"url":"https://api.github.com/repos/balderdashy/sails/issues/comments/177602466","html_url":"https://github.com/balderdashy/sails/issues/3534#issuecomment-177602466","issue_url":"https://api.github.com/repos/balderdashy/sails/issues/3534","id":177602466,"user":{"login":"mikermcneil","id":618009,"avatar_url":"https://avatars.githubusercontent.com/u/618009?v=3","gravatar_id":"","url":"https://api.github.com/users/mikermcneil","html_url":"https://github.com/mikermcneil","followers_url":"https://api.github.com/users/mikermcneil/followers","following_url":"https://api.github.com/users/mikermcneil/following{/other_user}","gists_url":"https://api.github.com/users/mikermcneil/gists{/gist_id}","starred_url":"https://api.github.com/users/mikermcneil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikermcneil/subscriptions","organizations_url":"https://api.github.com/users/mikermcneil/orgs","repos_url":"https://api.github.com/users/mikermcneil/repos","events_url":"https://api.github.com/users/mikermcneil/events{/privacy}","received_events_url":"https://api.github.com/users/mikermcneil/received_events","type":"User","site_admin":false},"created_at":"2016-01-31T20:31:46Z","updated_at":"2016-01-31T20:31:46Z","body":"@odnarb definitely not a bad idea to separate out your static files from your API, even if it's just for cleaner logging.  Personally, I've done it both ways, but obviously pushing assets off to a CDN is the best bet for optimizing load times.\r\n\r\n@jasalazar This is mysterious indeed-- you shouldn't have to point to `assets/`, because your flat files are actually being served from `.tmp/public/`.  My guess is that something is going on with your Grunt tasks (check out http://sailsjs.org/documentation/concepts/assets#?overview)\r\n\r\nOn a separate note though, the fact that `/assets` is working for you is a bit worrisome, because it probably means that your entire app is being served as the web root of your nginx server.  This isn't necessarily dangerous, it just means that all of your backend code will effectively be open source (because anyone can access it by visiting e.g. `/config/connections.js`).  If you want nginx to server your static files, I'd suggest pointing it at `.tmp/public/`.  Hope that helps!"}}