Closed zoe-1 closed 9 years ago
Make tweets promoting hapijs / university with the @hapijs tag in the tweet.
Then, @hueniverse can retweet them and get the word out.
I will promote too, my twitter account is jswenson74.
Cheers!
One question : on the home page , do we still have to display the path ?
@roelof1967 The path in the home page should be removed. Forgot to mention that. Thanks.
/*
* Redirect everything to tls
*/
server.ext('onRequest', function (request, reply) {
if (request.connection.info.protocol === 'http') {
return reply.redirect('https://localhost:8001' + request.url.path).code(301);
}
return reply.continue();
});
var Config = require('./config/config.js');
/*
* Important part of manifest JSON declaration for web-tls
*/
"connections": [
{
port: 8000,
labels: ['web']
},
{
host: 'localhost',
port: 8001,
labels: ['web-tls'],
tls: Config.tls
}
],
//
// config.js Used above in the manifest.
//
var fs = require('fs');
var config = module.exports = {};
// tls Trasport Layer Security (tls)
config.tls = {
key: fs.readFileSync('./lib/config/certs/server.key'), // Path to key
cert: fs.readFileSync('./lib/config/certs/server.crt'), // Path to Certificate
// This is necessary only if using the client certificate authentication.
requestCert: true,
// This is necessary only if the client uses the self-signed certificate.
ca: []
};
Above is to illustrate this.
//
// How to test on tls connection
//
it('GET request should respond properly.', function(done){
University.init(0, function(err, server){
expect(server.info.port).to.be.above(0);
// IMPORTANT this is how to inject into tis connection avoiding the redirect.
var tlserver = server.select('web-tls');
tlserver.inject({url: '/home', method: 'GET' }, function (response) {
expect(response.statusCode).to.equal(200);
server.stop(done);
});
});
});
I get a error message cannot call method of "replace" on udefined on the above test. Anyone who knows a good tutorial for making the certificates. I only get a perm file instead of the key and crt file
@roelof1967 links to tutorials below: openssl-essentials Heroku Tutorial Generate Self Signed Cert Another Tutorial Ubuntu http://en.wikipedia.org/wiki/Self-signed_certificate
@zoe-1 you said moving manifest in an external file is a good idea, why didn't we do it then ?
@zoe-1 in the assignment you have asked to keep certs under lib/certs
while in the example above shared, it is pointing to lib/config/certs
which path is the requirement of this assignment, I think the first one makes more sense.
One more problem after pulling in the laster master its not running getting following error when I run node start
module.js:338
throw err;
^
Error: Cannot find module '/Users/hussainanjar/workspace/personal/university/start'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
@hussainanjar
@zoe-1 thanks :)
another tutorial to make the certificates http://www.akadia.com/services/ssh_test_certificate.html
In order to give people more time to submit PRs, extending assignment6 due date until: June 12, 2015. Received two requests to slow things down a bit. Hopefully, this extension will give others space to complete the assignments.
Please share feed back on the pace of assignments, difficulty, etc...
I want to close this assignment and merge in a PR, however, all the PRs have some issues to fix before any can be merged. See comments below and the comments made in your projects. I reviewed all of them.
server.select('web').ext('onRequest', function (request, reply) {
return reply.redirect('https://localhost:8001' + request.url.path).permanent();
});
Tip: Write out your question and comments relating to problems you are trying to solve before posting them. As you type the comment, question, or problem to post it will cause you to define the problem and find the vocabulary to articulate it. This will create clarity and often results in you finding the solution before you post anything.
Nice feedback, although it might be more usefull to test soms random urls to see if they redirect to https, that wat you can be even more sure that all URLs are forwarded and not just the ones we have now, doing this for every route seems redundant, the point of being more protective I fully support though
@AdriVanHoudt Good to have you back making comments again :-)
I only have time for some comments I'm afraid ^^
Static Assets, Partials, and TLS
Configure the application to use TLS/SSL
Configure two server connections
Configure this connection to use the ssl certificates you just generated
and placed in ./lib/certs
Use TLS everywhere
Configure the application to always use TLS Transport Layer Security.
Every http request should be redirected to https. Two references:
Configure the home plugin.
Use Static Assets
"styles" for css, "scripts" for JS scripts,
"images" for project images.
and display it on the home page (home.html). (image is in the repo ./images/logo.png)
Name css file styles.css:
h3 { font-size: 24px; font-weight: bold; }
100% test coverage required
Exended Due Date is June 12, 2015
Original due date was June 6, 2015.
Next After This Assignment