Skip to content
This repository was archived by the owner on Jun 28, 2021. It is now read-only.
Merged
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
Fix node-http-proxy host in proxy request
node-http-proxy was putting a host header with the current server name,
which was thus causing nginx on the receiving end to send the request to
the default handler (or the first one). This patch asks node-http-proxy
to rewrite the host and port, and also to change the origin of the host
header to onequran's url.
  • Loading branch information
ahmedre committed Nov 19, 2016
commit f4d462b12b0034b716f7ed09a983deee01cf68bc
4 changes: 3 additions & 1 deletion src/server/config/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ const proxyApi = httpProxy.createProxyServer({
const proxyOneQuran = httpProxy.createProxyServer({
target: process.env.ONE_QURAN_URL,
secure: false,
proxyTimeout: 15000
proxyTimeout: 15000,
autoRewrite: true,
changeOrigin: true
});

proxyApi.on('error', (error, req, res) => {
Expand Down