Giter VIP home page Giter VIP logo

reverse-proxy-schematic's Introduction

CircleCI code style: prettier

reverse-proxy-schematic

Angular schematic for a development SSL wildcard reverse-proxy

What is it for?

It will allow you to serve http://localhost:4200 from a secured local domain like https://example.localhost. You can also add subdomains such that http://localhost:4201 will be served from https://subdomain.example.localhost.

Installation

  1. Download the source code to /path/to/reverse-proxy-schematic
  2. Go to your workspace and:
npm link /path/to/reverse-proxy-schematic
ng g /path/to/reverse-proxy-schematic/src/collection.json:proxy --hostname="example.localhost" --apiPort="5000" --apiRoute="api"

The apiPort and apiRoute args are optional and default to 5000 and api, respectively. If using cloud functions for the backend, you can provide the locally served URL (ex: 5000/example-com/us-central1) to the apiPort.

This schematic adds

  1. a proxy folder to the root of your workspace
  2. generate.proxy.cert and proxy scripts to package.json

What you need to setup

  1. update contents of proxy/cert/proxy.csr.cnf (change [COUNTRY CODE] to US and so on)
  2. run npm run generate.proxy.cert
  3. add /proxy/cert/ssl/rootCA.pem to your browser's Trusted Root Certification Authorities
  4. add the hostname domain and any subdomains to your local hosts file
  5. add custom scripts to package.json to serve each app via proxy (script name must start with start.):
  scripts: {
    //
    "start.app1": "ng serve --project=app1 --host=example.localhost --port=4200",
    "start.app2": "ng serve --project=app2 --host=subdomain.example.localhost --port=4201"
  }

Then npm run proxy (or npm run proxy -- -s), npm run start.app1, npm run start.app2 and open https://example.localhost

reverse-proxy-schematic's People

Contributors

galki avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.