This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const accessKeyId = process.env.AWS_ACCESS_KEY_ID; | |
const secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY; | |
const client = new CloudFront({ | |
credentials: async () => ({ accessKeyId, secretAccessKey }), | |
region: 'us-east-1' | |
}); | |
const { Distribution } = await client.createDistribution({ | |
DistributionConfig: { | |
Enabled: true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const accessKeyId = process.env.AWS_ACCESS_KEY_ID; | |
const secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY; | |
const acm = new ACM({ | |
credentials: async () => ({ accessKeyId, secretAccessKey }), | |
region: 'us-east-1' | |
}); | |
const { CertificateArn } = await acm.requestCertificate({ | |
DomainName: <<DOMAIN_NAME>>, | |
ValidationMethod: ValidationMethod.DNS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "redirect-tests", | |
"version": "1.0.0", | |
"description": "test the httpd.config redirects", | |
"main": "redirect.tests.js", | |
"dependencies": { | |
"axios": "^0.18.0" | |
}, | |
"devDependencies": { | |
"mocha": "^5.1.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## Add an additional configuration file to Apache for testing purposes | |
echo "Include /usr/local/apache2/conf.d/redirect-test.conf" >> /usr/local/apache2/conf/httpd.conf; | |
cat >> /usr/local/apache2/conf.d/redirect-test.conf <<EOF | |
RewriteCond %{HTTP_HOST} ^example.org$ [NC] | |
RewriteRule ^/(.*)$ http://mydomain.com/$1 [R=302,L] | |
EOF | |
## Start Httpd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM httpd:alpine | |
## Installing NodeJS | |
RUN apk add --update nodejs | |
## Copy Apache redirect rules | |
COPY ./conf.d /usr/local/apache2/conf.d | |
COPY ./httpd.conf /usr/local/apache2/conf.d/redirect.conf | |
RUN echo "Include /usr/local/apache2/conf.d/redirect.conf" >> /usr/local/apache2/conf/httpd.conf; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########################################################################## | |
## Apache Configuration ## | |
########################################################################## | |
ServerSignature Off | |
ServerName redirect.mydomain.com | |
LoadModule rewrite_module modules/mod_rewrite.so | |
Include /usr/local/apache2/conf.d/urlrewrite.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########################################################################## | |
## Url rewrite ## | |
########################################################################## | |
RewriteEngine On | |
## Rewrite myotherdomain.com to mydomain.com | |
RewriteCond %{HTTP_HOST} ^myotherdomain.com$ [NC] | |
RewriteRule ^/(.*)$ http://mydomain.com/$1 [R=302,L] | |
## All other domains |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require('axios'); | |
// check(host, path, expectedRedirect, statusCode) | |
// {host}: the host header of the request (without http(s)://) | |
// {path}: the path after the host | |
// {expectedRedirect}: the full URL of the Location header that should be returned | |
// {statusCode}: the expected status code (optional, defaults to 302) | |
const check = function(host, path, expectedRedirect, statusCode) { | |
path = path || ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Service, ServiceObj } from '@remie/nagios-cli'; | |
@Service({ | |
name: 'generic-service', | |
service_description: 'Generic Service', | |
active_checks_enabled: true, | |
passive_checks_enabled: true, | |
obsess_over_service: true, | |
check_freshness: false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import BaseService from './BaseService'; | |
import { Use, ServiceObj, Check } from '@remie/nagios-cli'; | |
@Use(BaseService) | |
export class Service extends ServiceObj { | |
private _check: Check; | |
constructor(description: string, check: Check) { | |
super(description); |
NewerOlder