【问题标题】:how can Apache reverse proxy to aspnet core api and anular 6 applicationApache如何反向代理asp net core api和angular 6应用程序
【发布时间】:2019-02-13 16:32:56
【问题描述】:

我有一个aspnet core apilocalhost:8080(红隼)上运行。一切都在localhost:80(apache 反向代理)上完美运行,可通过www.example.com 上的互联网访问

我想在此端口locahost:80(www.example.com) 上部署 Angular 客户端,并且仍然能够访问 www.api.example.comwww.example.com/api 上的 api。如何在我的.conf 文件中修改我的虚拟主机?

 <VirtualHost *:*>
     RequestHeader set "X-Forwarded-Proto" http
     RequestHeader set "X-Forwarded-Proto" https
 </VirtualHost>

 <VirtualHost *:80>
     ProxyPreserveHost On
     ProxyPass / http://127.0.0.1:8080/
     ProxyPassReverse / http://127.0.0.1:8080/
     ServerName www.example.com
     ServerAlias *.example.com
     ErrorLog /var/log/httpd/core_log
     CustomLog /var/log/httpd/core_access_log common
 </VirtualHost>

【问题讨论】:

    标签: angular apache reverse-proxy virtualhost


    【解决方案1】:

    尝试:

    ProxyPass /api/ http://127.0.0.1:8080/api/
    ProxyPassReverse /api/ http://127.0.0.1:8080/api/
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-07-28
      • 2020-03-30
      • 1970-01-01
      • 2021-05-22
      • 1970-01-01
      • 1970-01-01
      • 2020-10-04
      相关资源
      最近更新 更多