Apache - 使用子域路由和SSL在端口上暴露webapp。

问题描述 投票:0回答:1

我想通过子域用SSL或通过路由来暴露Web应用。

子域方法。

我正在运行的web应用是在http: /localhost: http:/localhost:4567

在以下配置的情况下,网页浏览器告诉我该应用 "不安全"(非https)。

该应用程序一般工作正常,但是非https的。

我做错了什么?有其他配置吗?

<IfModule mod_ssl.c>
    Listen 443
    NameVirtualHost *:443
</IfModule>

<VirtualHost *:80>
  ServerName blast.example.com
  Redirect permanent / https://blast.example.com/
</VirtualHost>

<IfModule mod_ssl.c>

<VirtualHost *:443>
    ServerAdmin [email protected]
    ServerName blast.example.com
    # ProxyPreserveHost On
    ProxyRequests off

    # setup the proxy
    <Proxy *>
        Order allow,deny
        Allow from all
    </Proxy>
#    ProxyPass / http://localhost:4567/
#    ProxyPassReverse / http://localhost:4567/

  <Location />
    ProxyPass http://localhost:4567/
    ProxyPassReverse http://localhost:4567/
  </Location>

  SSLEngine on
  SSLProtocol all -SSLv2 -SSLv3
  SSLCipherSuite ALL:!DH:!EXPORT:!RC4:+HIGH:+MEDIUM:!LOW:!aNULL:!eNULL

  SSLCertificateFile ...
  SSLCertificateKeyFile ...
  Include /etc/letsencrypt/options-ssl-apache.conf

</VirtualHost>

我一直在按照在 如何在Apache中用SSL配置多个子域?

PathRoute方法

我也曾试过将应用程序作为路由路径公开(即 https:/example.comblast)

  <Location /blast/ >
    ProxyPass http://localhost:4567/
    ProxyPassReverse http://localhost:4567/
  </Location>

但反向代理没有看到工作在,如果我开始与。

https://example.com/blast

并点击任何在开始页面.应用程序将生成一个内部URL 没有爆炸部分,导致404。

https://example.com/blah-blah-generated-url 
(should be https://example.com/blast/blah-blah-generated-url)

一般来说,子域路径似乎更好的工作 除了非https问题。

apache2 subdomain http-proxy
1个回答
0
投票

设置一个pathroute。

让应用程序可以通过 https:/example.comblast. 如果应用程序生成新的路由,则需要ProxyPassReverse;否则;只需要ProxyPass。

<VirtualHost *:443>
  ...
  ProxyPass "/blast/" "http://localhost:4567/"
  ProxyPassReverse "/blast/" "/"
  ...

在例1中发现,这里。ProxyPassReverse不重写Location(http头)

© www.soinside.com 2019 - 2024. All rights reserved.