GithubHelp home page GithubHelp logo

isabella232 / media_fallback Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chassis/media_fallback

0.0 0.0 0.0 9 KB

If an image request within the VM 404s, try retrieving the image from another server.

Puppet 59.31% HTML 40.69%

media_fallback's Introduction

Media Fallback

This Chassis extension adds an Nginx rule within your Chassis virtual machine to fall back to production URLs for any local media request which fails with a "404 not found" error. This allows you to run a fully functional virtual machine with a much smaller backup of the uploads/ folder than would normally be necessary, because any image which is not available locally within the VM can then be requested from a live site instead.

Usage

  1. Clone this into the extensions folder of your Chassis installation, or list chassis/media_fallback in your Chassis configuration file's extensions list.
  2. Add a media_fallback: key to your configuration file specifying the URI for a deployed environment's content folder (example below).
  3. Run vagrant up if you have not yet initialized your virtual machine, or vagrant provision if your VM is already up and running.

A request to an image path within your VM that 404s should now attempt to retrieve that image from production (or staging, etcetera, depending on configuration).

Example Configuration

The value of the media_fallback key should always be the path to a content folder within a deployed site.

Assuming you are creating a local environment for the website https://example.com, which uses the standard WordPress directory path wp-content, you may enable your VM to fall back to this site with the following configuration:

# config.local.yaml

media_fallback: 'https://example.com/wp-content'

media_fallback's People

Contributors

kadamwhite avatar

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.