Фронтирование nodejs / angular с apache приводит к невозможности загрузки ресурса - PullRequest
0 голосов
/ 22 октября 2018
[EDITED]

Мы пытаемся использовать наш прокси-сервер Apache для нашего узла js-сервера, на котором выполняется приложение Angular.Наше приложение Node JS состоит из набора методов API и внешнего интерфейса Angular 6.

Apache прослушивает https://[our site], и ​​мы хотели бы, чтобы подкаталог https://[our site] / v4 шел впереди нашего узла js, который работает на http://localhost:3000

Пока что мы добавили эти элементы конфигурации в httpd.conf

    ProxyPass /v4 http://localhost:3000
    ProxyPassReverse /v4 http://localhost:3000

Для угловой части это приводит к:

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)

Когда я пытаюсь вызвать метод входа в нашем APIв https://[our site] / v4 / api / login мы получаем это возвращение:


    <!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>

Какие правила переписывания нам нужно добавить, чтобы сделать эту работу?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...