All Projects → garethr → Nginx Json Proxy

garethr / Nginx Json Proxy

An experiment with openresty, lua and nginx

Labels

Projects that are alternatives of or similar to Nginx Json Proxy

React Express Fullstack
Full stack (mostly unopinionated) starter pack with React+Redux and Expressjs
Stars: ✭ 23 (+130%)
Mutual labels:  nginx
Gowebsocket
golang基于websocket单台机器支持百万连接分布式聊天(IM)系统
Stars: ✭ 937 (+9270%)
Mutual labels:  nginx
Nuxt Ssr Demo
✨ 高仿掘金,整合 vue + nuxt + axios + vuex + vue-router (nuxt 自带 vuex 和 vue-router),一个基于 Nuxt 的服务器端渲染 Demo
Stars: ✭ 856 (+8460%)
Mutual labels:  nginx
Ansible Nginx Drupal
Ansible role to configure Nginx for running Drupal using perusio's configuration
Stars: ✭ 23 (+130%)
Mutual labels:  nginx
Ngx mruby Package Builder
Package Builder of ngx_mruby with Docker
Stars: ✭ 25 (+150%)
Mutual labels:  nginx
Stepic web project
Stars: ✭ 8 (-20%)
Mutual labels:  nginx
Nginx Auth Proxy
Authentication for multiple services using nginx
Stars: ✭ 22 (+120%)
Mutual labels:  nginx
Status Nginx Module
A http status module for pure nginx, which is in production already.
Stars: ✭ 10 (+0%)
Mutual labels:  nginx
Php Interview
PHP后端开发面试指南。
Stars: ✭ 26 (+160%)
Mutual labels:  nginx
Ngx http proxy connect module
A forward proxy module for CONNECT request handling
Stars: ✭ 850 (+8400%)
Mutual labels:  nginx
Jale
Jale is a blazing fast local development environment for MacOS written in Typescript.
Stars: ✭ 24 (+140%)
Mutual labels:  nginx
Meteorn
MeteorN - A Simple Tool to Run Meteor App with an Nginx Reverse Proxy
Stars: ✭ 25 (+150%)
Mutual labels:  nginx
Springbootunity
rabbitmq、redis、scheduled、socket、mongodb、Swagger2、spring data jpa、Thymeleaf、freemarker etc. (muti module spring boot project) (with spring boot framework,different bussiness scence with different technology。)
Stars: ✭ 845 (+8350%)
Mutual labels:  nginx
The World Is Yours
Nginx L7 DDoS Protection! And many more features 💥 ⚡️
Stars: ✭ 20 (+100%)
Mutual labels:  nginx
Devops Tuts
Meteor Devops on OSX with Docker set for Ubuntu
Stars: ✭ 10 (+0%)
Mutual labels:  nginx
Docker Php Nginx
Lightwight Docker image for the (latest) PHP-FPM and Nginx based on AlpineLinux
Stars: ✭ 22 (+120%)
Mutual labels:  nginx
Docker Socket Http Proxy
Simple nginx proxy container for the docker socket
Stars: ✭ 7 (-30%)
Mutual labels:  nginx
Netkiller.github.io
Netkiller Free ebook - 免费电子书
Stars: ✭ 861 (+8510%)
Mutual labels:  nginx
Hack Lang Hhvm Resources
Landscaping With Hack Lang & HHVM Resources
Stars: ✭ 10 (+0%)
Mutual labels:  nginx
Nginx Tutorial
这是一个 Nginx 极简教程,目的在于帮助新手快速入门 Nginx。
Stars: ✭ 845 (+8350%)
Mutual labels:  nginx

nginx-json-proxy

Ever wanted make sure you're only passing JSON across a boundary? Every thought the best place to do this would be in Lua embedded in nginx? This project is for you.

Usage

You can test out the example by running openresty:

openresty -c `pwd`/config/nginx.conf

Then making requests via curl:

# valid JSON
curl -X POST -d '["bob", "jim"]' http://localhost:3000/
["bob","jim"]

# invalid JSON
curl -X POST -d '["bob", "jim]' http://localhost:3000/
invalid request

Rather than use a real backend the example currently just hard codes the response. If you change the response by commenting line 66 and uncommenting line 67 to return invalid JSON then you should get:

# valid JSON, with invalid JSON response
curl -X POST -d '["bob", "jim"]' http://localhost:3000/
invalid response

Installing OpenResty

brew install openresty
brew install lua51

Installing cjson

wget https://github.com/keplerproject/luarocks/archive/v2.2.2.tar.gz
tar xfv v2.2.2.tar.gz
cd luarocks-2.2.2
./configure
make build
make install
luarocks install lua-cjson

Thanks

Thanks to Tommy Hall and his nginx-lua-examples for the Rakefile and Procfile which made getting started easier.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].