I have a mean app that's more on the Angular side than the node side. It's working fine on http://localhost:3000 but I am attempting to use the built in tools and generated code for ssl. There is a built in grunt task called 'secure' that runs the app on port 443 for you.
// Secure task(s).
grunt.registerTask('secure', ['env:secure', 'lint', 'concurrent:default']);
After running the ssh-generation-script that comes with meanjs. I added to my env/all.js file:
secure: {
ssl: true,
privateKey: './config/sslcerts/key.pem',
certificate: './config/sslcerts/cert.pem'
},
Running the app 'sudo grunt secure':
Running "concurrent:default" (concurrent) task Running "watch" task Running "nodemon:dev" (nodemon) task Waiting...
[nodemon] v1.2.1 [nodemon] to restart at any time, enter
rs
[nodemon] watching: app/views/** /. gruntfile.js server.js config/** /*.js app/**/*.js[nodemon] starting
node --debug server.js
Debugger listening on port 5858 Application loaded using the "secure" environment configurationSecurely using https protocol Application started on port 443
I haven't yet switched to html5 routes but I plan to.
So right now my urls look like for example /#!/app/search. When hitting the http://localhost:3000/#!/app/search if not logged in you get redirected to /#!/login and so on. Everything works great on http. When trying to get to https://localhost in chrome I get googles prompt to allow it, normal ssl behaviour, but when I do the page is blank. It's supposed to be watching
app/views/** /. gruntfile.js server.js config/** /*.js app/**/*.js
But when viewing the page source It hasn't pulled in all the scripts it should or normally does on port 3000, there are just a few base angular scripts. No requests ever hit on the node side either. Obviously because I'm hitting localhost and not localhost/#!/app/search. It's not pulling in the scripts far as I can tell. And it's not hitting the correct route no matter what I do. I'm not sure what else say or show as evidence. Like I said everything works great starting grunt with just 'grunt'. I've never used ssl with meanjs before so I'm not really sure what else do to.
RESOLVED!!
Well I posted this moments ago... sometimes it really does help to think through the problem. So I went to the source and found out the issue was that it wasn't loading the files I needed ... the reason? My env/secure.js 'grunt secure' skips any other env/ file. So I copies my assets: {}, secure: {}, db: '' objects from "all.js" to secure.js
'use strict';
module.exports = {
port: 443,
//db: process.env.MONGOHQ_URL || process.env.MONGOLAB_URI || 'mongodb://localhost/testing',
secure: {
ssl: true,
privateKey: './config/sslcerts/key.pem',
certificate: './config/sslcerts/cert.pem'
},
db: 'mongodb://localhost/app',
//assets: {
// lib: {
// css: [
// 'public/lib/bootstrap/dist/css/bootstrap.min.css',
// 'public/lib/bootstrap/dist/css/bootstrap-theme.min.css'
// ],
// js: [
// 'public/lib/angular/angular.min.js',
// 'public/lib/angular-resource/angular-resource.min.js',
// 'public/lib/angular-animate/angular-animate.min.js',
// 'public/lib/angular-ui-router/release/angular-ui-router.min.js',
// 'public/lib/angular-ui-utils/ui-utils.min.js',
// 'public/lib/angular-bootstrap/ui-bootstrap-tpls.min.js'
// ]
// },
// css: 'public/dist/application.min.css',
// js: 'public/dist/application.min.js'
//},
assets: {
lib: {
css: [
'public/lib/bootstrap/dist/css/bootstrap.css',
'public/lib/bootstrap/dist/css/bootstrap-theme.css',
'public/lib/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css',
'public/lib/angular-xeditable/dist/css/xeditable.css'
],
js: [
'public/lib/angular/angular.js',
'public/lib/angular-resource/angular-resource.js',
'public/lib/angular-cookies/angular-cookies.js',
'public/lib/angular-animate/angular-animate.js',
'public/lib/angular-touch/angular-touch.js',
'public/lib/angular-sanitize/angular-sanitize.js',
'public/lib/angular-ui-router/release/angular-ui-router.js',
'public/lib/angular-ui-utils/ui-utils.js',
'public/lib/angular-bootstrap/ui-bootstrap-tpls.js',
'public/lib/angular-smart-table/dist/smart-table.js',
'public/lib/angular-autoFields-bootstrap/autofields.js',
'public/lib/angular-autoFields-bootstrap/autofields-bootstrap.min.js',
'public/lib/jquery/dist/jquery.min.js',
'public/lib/moment/min/moment.min.js',
'public/lib/bootstrap/dist/js/bootstrap.min.js',
'public/lib/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js',
'public/lib/angular-bootstrap-datetimepicker-directive/angular-bootstrap-datetimepicker-directive.min.js',
'public/lib/angular-ui-router-tabs/src/ui-router-tabs.js',
'public/lib/angular-xeditable/dist/js/xeditable.min.js',
'public/lib/angular-ui-mask/dist/mask.js',
'public/lib/angular-resource/angular-resource.js',
'public/lib/lodash/lodash.js',
'public/lib/restangular/dist/restangular.js',
'public/lib/ngprogress/build/ngprogress.js',
'public/lib/angular-scroll/angular-scroll.js'
]
},
css: [
'public/modules/**/css/*.css',
'public/lib/ngprogress/ngProgress.css'
],
js: [
'public/config.js',
'public/application.js',
'public/modules/*/*.js',
'public/modules/*/*[!tests]*/*.js'
],
tests: [
'public/lib/angular-mocks/angular-mocks.js',
'public/modules/*/tests/*.js'
]
}
};