Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reverse proxy docs #895

Open
wants to merge 2 commits into
base: gh-pages
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions tutorial/reverse-proxy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: Reverse Proxy
parent: Malibu Tutorial
nav_order: 31

---

In computer networks, a reverse proxy is the application that sits in front of back-end applications and forwards client requests to those applications.

To implement reverse proxy we are using an npm package named `http-proxy`. Here is a sample implementation of reverse proxy:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dont we need to implement both the cases you worked on? One with ignorePath and one without?


```
const app = require('express')()
const httpProxy = require("http-proxy");

// target - url string to be targeted
const apiProxy = httpProxy.createProxyServer({
target: "https://deals.example.com",
changeOrigin: true,
});

/* ignorePath - true/false, Default: false - specify whether you want to ignore the proxy path of the incoming request (note: you will have to append / manually if required) */

app.get("/deals", (req, res) => {
apiProxy.web(req, res, { ignorePath: true });
});

```