npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

api-gateway-proxy-lambda

v0.2.2

Published

AWS Lambda to proxy calls to specific host

Downloads

4

Readme

API Gateway Proxy Lambda

Build Status npm version Coverage Status

Purpose: lambda to proxy incoming calls to defined host

How to use

  • Create lambda index.js
  • Setup API Gateway resource with ANY method
    • Enable proxy mode

Configuration

All configuration done by env properties

  • TARGET_DOMAIN: string, required - target proxy host (exclude protocol)
  • TARGET_PORT: number, optional, default 80 for http and 443 for https - target proxy port
  • CORS: boolean, optional, default false - automatically add CORS header to all responses
  • CORS_AUTO_OPTIONS: boolean, optional, default false - replay on all OPTIONS request correct CORS for all *
  • EXCLUDE_PATH_PREFIX: string, optional, default empty - very useful for API Gateway, this string will be exclude from start of path. For example you send request to http://x/Stage1/start and want to proxy as http://target/start, just configure that property /Stage
  • PATH_PREFIX: string, optional, default empty - prefix to add in proxy path

Configuration example:

Lambda
  Type: AWS::Lambda::Function
  Properties:
    Environment:
      Variables:
        TARGET_DOMAIN: test.com
        TARGET_PORT: 8080
        CORS: true
        CORS_AUTO_OPTIONS: false
        PATH_PREFIX: abb
        EXCLUDE_PATH_PREFIX: /Stage1

Releases

0.2.2

  • update docs

0.2.1

  • support CORS auto OPTIONS response when process.env.CORS_AUTO_OPTIONS = true
  • fix event.path to event.resourcePath
  • add coverage report

0.2.0

  • support process.env.EXCLUDE_PATH_PREFIX: String if defined and path starts from it will be removed before proxy. For example path before proxy /Beta/test and exclude /Beta proxied path will be /test
  • fix httpMethod passing
  • log incoming event and proxy request when process.env.DEBUG enabled
  • support process.env.HTTPS: Boolean to use HTTPS for proxy request
  • support process.env.CORS: Boolean to add CORS headers

0.1.0

  • support process.env.PATH_PREFIX

0.0.1

  • initial release