Secure is an HTTP middleware for Go that facilitates some quick security wins. It's a standard net/http Handler, and can be used with many frameworks or directly with Go's net/http package. Be sure to include the Secure middleware as close to the top (beginning) as possible (but after logging and recovery). It's best to do the allowed hosts and SSL check before anything else. When IsDevelopment is true, the AllowedHosts, SSLRedirect, STS header, and HPKP header will not be in effect. This allows you to work in development/test mode and not have any annoying redirects to HTTPS (ie. development can happen on HTTP), or block localhost has a bad host. Secure comes with a variety of configuration options. Secure allows you to set a custom function for the AllowRequestFunc option. You can use this function as a custom filter to allow the request to continue or simply reject it.

Features

  • Facilitates some quick security wins
  • It's a standard net/http Handler
  • Can be used with many frameworks or directly with Go's net/http package
  • Secure comes with a variety of configuration options
  • Set the IsDevelopment option to true when developing
  • Allow Request Function
  • Redirect HTTP to HTTPS

Project Samples

Project Activity

See All Activity >

License

MIT License

Follow Secure

Secure Web Site

Other Useful Business Software
MongoDB Atlas runs apps anywhere Icon
MongoDB Atlas runs apps anywhere

Deploy in 115+ regions with the modern database for every enterprise.

MongoDB Atlas gives you the freedom to build and run modern applications anywhere—across AWS, Azure, and Google Cloud. With global availability in over 115 regions, Atlas lets you deploy close to your users, meet compliance needs, and scale with confidence across any geography.
Start Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of Secure!

Additional Project Details

Operating Systems

Linux, Mac, Windows

Programming Language

Go

Registered

2023-01-24