Skip to content
This repository has been archived by the owner. It is now read-only.

ct-martin/rimg

main
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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.