Giter Site home page Giter Site logo

cf-redirector's Introduction

cf-redirector

cf-redirector is a small Cloud Foundry application for redirecting traffic bound for one route over to another, via standard HTTP 3xx redirection mechanisms.

Deployment

Hey, it's Cloud Foundry!

cf push point-a --no-start
cf set-env point-a REDIRECT_TO other.domain.cf.tld
cf set-env point-a STATUS_3XX 301
cf start

If you want, you can also just run ./deploy:

./deploy
Where do you want to redirect? > ...

The ./deploy script passes through the environment variables used to configure the application (see next section) if they are present in the calling environment:

DEBUG=1 ./deploy

You can also specify whatever additional cf push arguments you want, such as the hostname and domain of the new app:

DEBUG=1 ./deploy --hostname host-a --domain my.cf.tld

Configuration

Configuration is done entirely through environment variables:

  • REDIRECT_TO is the full hostname of the other CF application that you want to redirect your traffic to. This value is required.
  • REDIRECT_SCHEME is the URL scheme ('http' or 'https') to force redirection to. By default, this is 'https'.
  • STATUS_3XX is the HTTP status code to use when issuing redirect responses. This value must be between 300 and 399. By default, HTTP 302's are sent.
  • DEBUG, if set, will turn on debugging messages, to standard error, that can be viewed with cf logs. This is useful for verifying that your configuration is correct, but is not advisable in production settings with high traffic.

To configure these, use cf set-env and then restage your app:

cf set-env my-redirector REDIRECT_SCHEME http
cf restage my-redirector

cf-redirector's People

Contributors

jhunt avatar

Watchers

Wayne E Seguin avatar Bill Chapman avatar Matt Reider avatar Juan Antonio Breña Moral avatar David Laing avatar David Ehringer avatar Mevan Samaratunga avatar Alex Heneveld avatar Colin Humphreys avatar James Cloos avatar Jared Wray avatar Johannes Hiemer avatar Sylvain Gibier avatar Cornelia Davis avatar Doug Davis avatar Van Nguyen avatar Ronak Banka avatar Takeshi Morikawa avatar Amulya Sharma avatar Benjamin Gandon avatar Chanda Dharap avatar Xiujiao Gao avatar Guillaume Berche avatar Fermin Ordaz avatar  avatar clarence avatar  avatar Pierre Oblin avatar Arthur Halet avatar Weian Deng avatar Balajee Nagarajan avatar Aaron Gershman avatar Josh Quintana avatar Jian Huang avatar Mo Mo avatar  avatar Justin Carter avatar Andrei Krasnitski avatar Piotr Milewski avatar Chris McGowan avatar  avatar Norman Abramovitz avatar  avatar  avatar

Forkers

sacquatella

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.