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
package main | |
import ( | |
"net/http" | |
"log" | |
) | |
func HelloServer(w http.ResponseWriter, req *http.Request) { | |
w.Header().Set("Content-Type", "text/plain") | |
w.Write([]byte("This is an example server.\n")) |
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
# Default admin url | |
url(r'^admin/', admin.site.urls), | |
# Replace with following url | |
url(r'^my_secure_admin_location/', admin.site.urls), |
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
response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate" | |
response.headers["Pragma"] = "no-cache" | |
response.headers["Expires"] = "Sat, 01 Jan 2000 00:00:00 GMT" |
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
config.action_controller.default_url_options = {host: "www.yoursite.com"} | |
config.action_controller.asset_host = "www.yoursite.com" |
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
function requestHandler(req, res) { | |
res.setHeader('Strict-Transport-Security', 'max-age=630720; includeSubDomains; preload'); | |
} |
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
function requestHandler(req, res) { | |
res.setHeader( 'X-XSS-Protection', '1; mode=block' ); | |
} |
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
function requestHandler(req, res) { | |
res.setHeader( 'X-Frame-Options', 'SAMEORIGIN' ); | |
} |
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
var express = require('express'); | |
var app = express(); | |
app.use(function(req, res, next) { | |
res.setHeader( "Content-Security-Policy", "script-src 'self' https://analytics.google.com" ); | |
return next(); | |
}); | |
app.use(express.static(__dirname + '/')); |
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
function requestHandler(req, res) { | |
res.setHeader( 'Content-Security-Policy', "script-src 'self'" ); | |
} |
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
function requestHandler(req, res) { | |
res.setHeader( 'Cache-Control', 'no-cache, no-store, max-age=0, must-revalidate' ); | |
res.setHeader( 'Pragma' , 'no-cache' ); | |
res.setHeader( 'Expires' , 'Sat, 01 Jan 2000 00:00:00 GMT' ); | |
} |
OlderNewer