Skip to content

A Vapor middleware to redirect reverse proxy requests originating as http to https.

Notifications You must be signed in to change notification settings

labradon/vapor-xfp-middleware

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

X-Forwarded-Proto SSL Middleware for Vapor

A Vapor middleware to redirect reverse proxy requests originating as http to https.

For example, if you are deploying a Vapor app to a Heroku free dyno, you might wish to piggyback on the SSL of the herokuapp.com domain. The Heroku router will relay both http and https requests to your app as http, but report the original scheme in the appended header X-Forwarded-Proto. We can inspect this header, and use it to redirect http requests to https.

Usage

To use Vapor X-Forwarded-Proto Middleware, add the middleware to your services:

let services = Services.default()
let middlewares = MiddlewareConfig()
middlewares.use(XFPMiddleware())
services.register(middlewares)

let app = Application(services: services)

About

A Vapor middleware to redirect reverse proxy requests originating as http to https.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 100.0%