Last active
November 7, 2022 07:54
-
-
Save dunnza/67c7f1705daba5a1bb5f750d5f5766b1 to your computer and use it in GitHub Desktop.
How to proxy api requests with NTLM authentication in a create-react-app project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require("http"); | |
const proxy = require("http-proxy-middleware"); | |
module.exports = function(app) { | |
app.use( | |
"/api", | |
proxy({ | |
agent: new http.Agent({ keepAlive: true }), | |
target: "http://example.com/", | |
onProxyRes(proxyRes) { | |
const header = "www-authenticate"; | |
proxyRes.headers[header] = | |
proxyRes.headers[header] && proxyRes.headers[header].split(","); | |
} | |
}) | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@TeonWasTaken I'm glad it helped you!