Skip to content

Instantly share code, notes, and snippets.

Created December 3, 2018 18:48
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Creating a simple ambassador container to override 404 HTTP responses.
let { Ambassador } = require('../node-ambassador/')
const TARGET = process.env['target_port'] || 8087
const PORT = process.env['port'] || 8080
const HTTP404 = `const HTTP404 =
HTTP/1.0 404 File not found
Server: Sitio 💥
Date: ${Date()}
Content-Type: text/html
Connection: close
<H1>Look Somewhere Else / Not Found</H1>
<img src="">
function override_404({service, server}) {
service.on('http:404', () => server.respond(HTTP404))
new Ambassador({port: PORT, target: TARGET})
console.log(`listening for request in ${PORT} and targeting ${TARGET}`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment