Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

The default middleware for Buffalo apps

License

NotificationsYou must be signed in to change notification settings

gobuffalo/middleware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Standard TestGo Report CardGo Reference

Middleware is a fundamental module that provides the default middleware forbuffalo applications.

Installation

with Buffalo

The default middleware is setup by default on a new Buffalo app.

$buffalo new myapp

Buffalo CLI will generate application scafflod andactions/app.go will beconfigured to use default middlewares by default.

Standalone

$go get github.com/gobuffalo/middleware

contenttype

contenttype middleware provides a feature that sets the fallback content type(which is used when the client sent nothing) or overrides the client-specifiedcontent type.This middleware will be enabled by default in your app when you generate a newAPI application withbuffalo new --api command.

csrf

csrf middleware providesCSRFprotection for Buffalo apps.This middleware will be enabled by default in your app when you generate a newapplication scaffold withbuffalo new command.

forcessl

forcessl middleware provides a feature that automatically redirects requeststhat is not use HTTPS.This middleware will be enabled by default in your app when you generate a newapplication scaffold withbuffalo new command.It is configured to enforce the redirection in theproduction mode only. Youcould customize it inactions/app.go if you need a different behavior.

i18n

i18n middleware provides internationalization support in your application:

  • User language detection from configurable sources
  • Translation helper using locales bundles from github.com/nicksnyder/go-i18n
  • Localized views

Seehttps://gobuffalo.io/documentation/guides/localization/ for furtherinformation about Buffalo translation features and configuration.

paramlogger

paramlogger middleware provides the request parameter logging feature.This middleware will be enabled by default in your app when you generate a newapplication scaffold withbuffalo new command.

By default, it filters out pre-defined sensitive parameters and they will beprinted as[FILTERED] in the log. (keywords are case insensitive)

Currently, the pre-defined parameters are:

  • password
  • passwordconfirmation
  • creditcard
  • cvc

paramlogger also allows to exclude user-defined parameters by specifyingthose in theParameterExclusionList before using the ParamegerLoggermiddleware in the app.

paramlogger.ParameterExclusionList=append(paramlogger.ParameterExclusionList,"secret","phone_number")app.Use(paramlogger.ParameterLogger)

or

paramlogger.ParameterExclusionList= []string{"password","passwordconfirmation","secret","phone_number",    }app.Use(paramlogger.ParameterLogger)

Documentation

About

The default middleware for Buffalo apps

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors3

  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp