Giter Site home page Giter Site logo

camo-js's Introduction

camo-js

About

Original implementation: atmos/camo.

A camo server is a special type of image proxy that proxies non-secure images over SSL/TLS, in order to prevent mixed content warnings on secure pages. The server works in conjunction with back-end code that rewrites image URLs and signs them with an HMAC.

                                                                      
        +------------+       Request       +------------+             
        |            |  ---------------->  |            |             
        |            |                     |   Primary  |             
        |            |  <----------------  |   Server   |             
        |            |                     |            |             
        |   Client   |  https://camo/img   +------------+             
        |            |                     +------------+ http://image
        |            |  ---------------->  |            | ----------->
        |            |                     |   Camo     |             
        |            |     Image Data      |   Server   | Image Data  
        |            |  <----------------  |            | <-----------
        +------------+                     +------------+             

Usage

The URL format follows the syntax below:

http://server.com/<digest>/<encoded-image-url>

The <digest> is a 40 character hex encoded HMAC digest generated with a shared secret key and the unescaped <encoded-image-url> value. The <encoded-image-url> is the absolute URL locating an image. Each byte of the should be hex encoded such that the resulting value includes only characters [0-9a-f].

An encodeHex function is exposed from the utils directory to generate digest and encoded url from an insecure url.

Environment

CAMO_PORT: The port that the Camo server will listen to. (Default: 8081)

CAMO_KEY: A shared key consisting of a random string, used to generate the HMAC digest.

CAMO_URI: The public URI of the Camo server. (Default: http://localhost:8081)

Development

yarn dev

Building

pm2 is used for daemonizing as a process supervisor.

yarn build

Testing

yarn test

Other implementations

camo-js's People

Contributors

dependabot[bot] avatar zignis 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.