[EDITED]
我们正在尝试让我们现有的Apache服务器代理成为我们的节点js服务器, 运行一个Angular应用程序。我们的Node JS应用程序由API方法的集合和Angular 6前端组成。
Apache侦听https://[our站点],我们希望子目录https://[our站点] / v4位于运行在http://localhost:3000上的节点js前面。
到目前为止,我们已经将此配置项添加到了httpd.conf
ProxyPass /v4 http://localhost:3000 ProxyPassReverse /v4 http://localhost:3000
对于Angular部分,结果为:
styles.js:1 Failed to load resource: the server responded with a status of 404 (Not Found) runtime.js:1 Failed to load resource: the server responded with a status of 404 (Not Found) polyfills.js:1 Failed to load resource: the server responded with a status of 404 (Not Found) styles.js:1 Failed to load resource: the server responded with a status of 404 (Not Found) scripts.js:1 Failed to load resource: the server responded with a status of 404 (Not Found) main.js:1 Failed to load resource: the server responded with a status of 404 (Not Found) vendor.js:1 Failed to load resource: the server responded with a status of 404 (Not Found) main.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
当我尝试在https://[our网站] / v4 / api / login的API中调用登录方法时,我们得到以下返回信息:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html> <head> <title>502 Proxy Error </head> <body> <h1>Proxy Error <p>The proxy server received an invalid response from an upstream server. <br /> The proxy server could not handle the request <em> <a href="/v4/api/login">POST /v4/api/login </em>. <p> Reason: <strong>Error reading from remote server </p> </p> </body> </html>
要使这项工作有效,我们需要添加哪些重写规则?