Skip to content

quick & dirty local dev routing for development using a upstream staging server. Avoid browser same origin policies or connect multiple independent backends into a simple local development environment. E.g.: let developers use your staging server for real data and api access while requiring 0 setup

Notifications You must be signed in to change notification settings

tbscode/schroedingers-nginx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

NGINX dev proxy-pass container

Made this script for local frontend development, that has to access an API server on the web, under the same server route. But this script can be used for general development routing purposes. This easily lets you set-up a development server with multiple proxy-pass paths to different server backend urls.

schrodingers-nginx.sh allows to:

  • by-pass CORS and same-site policies when accessing API test server in development setting
  • reroute different server API routes to one development URL
  • reroute development server to host URL of backend server.

Usage

Required:

  • docker (will pull the official nginx docker image)
  • bash

Update SERVER_URL, PROXY_PATH, SERVER_PATH arrays to your needs, run the script.

This will start the nginx-proxy docker container, default route is localhost:3333 port can be changed via ACESS_PORT.

Example

SERVER_URL=( "host.docker.internal:3000" "test-server.com" "test-server.com" )
PROXY_PATH=( "/" "/api2/v2/" "/web-socket" )
SERVER_PATH=( "/" "/api2/" "/socket" )

This routes all root traffic from localhost:3333/ to localhost:3000 e.g. a local development frontend. From localhost:3333 api calls or websocket connections are passed to respective urls at test-server.com.

Script tested on mac, linux, chromeos.

About

quick & dirty local dev routing for development using a upstream staging server. Avoid browser same origin policies or connect multiple independent backends into a simple local development environment. E.g.: let developers use your staging server for real data and api access while requiring 0 setup

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages