【问题标题】:Is there a way to setup ProxyPass in httpd conf for node server有没有办法在节点服务器的 httpd conf 中设置 ProxyPass
【发布时间】:2020-05-27 05:31:04
【问题描述】:

我在 80 端口上运行我的 Apache httpd 服务器,它提供 Web 服务。同时,与 Vue js 一起工作的 node.js 服务器在 8080 端口上运行。

为了进行这种多端口管理,我在 httpd conf 中提到了代理传递,如下所示。

LoadModule proxy_module /usr/lib64/apache2/mod_proxy.so
LoadModule proxy_http_module /usr/lib64/apache2/mod_proxy_http.so
<VirtualHost *:80>
        ProxyPass /node http://localhost:8080/node/
        ProxyPassReverse /node http://localhost:8080/node/
</VirtualHost>

下面显示的是设置上述代理设置后的错误。 提到的 app.js 可以作为http://localhost:8080/app.js

【问题讨论】:

    标签: node.js apache vue.js httpd.conf mod-proxy


    【解决方案1】:
    You can also solve this problem with CORS settings in Apache conf:
    
      # remember to replace /var/www with your directory root
      <Directory /var/www>
        # some other apache code here, if any
        # replace the url to the one you wanted
        Header set Access-Control-Allow-Origin "http://localhost:8080"
        # some other apache code here, if any
      </Directory>
    

    【讨论】:

      猜你喜欢
      • 2019-10-14
      • 1970-01-01
      • 2016-04-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-09
      • 2014-03-14
      相关资源
      最近更新 更多