Skip to content

Instantly share code, notes, and snippets.

@bjesuiter
Last active March 25, 2022 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjesuiter/bb25ba96d0e1d0648b96cab2cd5d472e to your computer and use it in GitHub Desktop.
Save bjesuiter/bb25ba96d0e1d0648b96cab2cd5d472e to your computer and use it in GitHub Desktop.
Development Quicktips

Angular API Proxies

Base Problem

  • Requests from Localhost to REST Services on Testing & Staging Environments may be forbidden by CORS.

Solution - Angular API Proxy

{
  "/my-local-path": {
    "target": "https://api.myserver.com/",
    "pathRewrite": {
      "^/my-local-path": ""
    },
    "changeOrigin": true
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment