Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Latest commit

 

History

History
33 lines (27 loc) · 1.47 KB

README.md

File metadata and controls

33 lines (27 loc) · 1.47 KB

rimg

Image resizing microservice

Code Tests Deploy Maintainability Test Coverage

Goals

  • Resize images
  • As fast as possible
  • Support both generic width/height and oEmbed maxwidth/maxheight
  • Basic abuse prevention
    • Forward Referer to origin and CORS headers back
    • Optional list of allowed hostnames to resize from
    • MIME checking of requested image

Running

  • npm run dev uses nodemon & ts-node to run and restart on watches in a single command
  • npm run build & npm run start can be used by Heroku buildpack-based pipelines

Environment variables

  • ALLOWED_HOSTNAMES - comma-separated list of hostnames to allow (including port if applicable)
  • PORT - Port to run server on

Anti-goals

  • Caching; this should be done by another layer
    • Caching headers from the origin should be passed back though
  • TLS; this should be done by a proxy

Security note

This acts as a proxy and may enable access to internal IP ranges. PLEASE use ALLOWED_HOSTNAMES environment variable and configure your firewall correctly.