Apache反向代理子域到端口

问题描述

我正在尝试设置一个Apache反向代理以实现以下结果。

预期结果

访问https://service.example.com时,apache将提供http://localhost:8080中的内容,https://service.example.com是在本地主机上运行的另一个服务/网络服务器。

实际结果

访问https://example.com时,apache会返回https://example.com的内容(并给出一些证书问题)。

当前配置

<VirtualHost *:80> ServerName service.example.com ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass / http://localhost:8080 ProxyPassReverse / http://localhost:8080 <Location /> Order allow,deny Allow from all </Location> </VirtualHost> 处正在运行一个SSL apache服务器,该服务器使用let加密通配符证书。

应该启用反向代理的虚拟主机文件如下所示:

/sites-enabled

该文件已通过a2ensite service.conf激活,并具有指向// fetch chunks from somewhere let urls = ["http://foo.bar/chunk/1","http://foo.bar/chunk/2"]; let chunkPromises = urls.map(url => { return fetch(url).then(res => { return res.arrayBuffer(); }); }); Promise.all(chunkPromises).then(chunks => { // combine chunks into a single blob let blob = new Blob(chunks,{ // Optional: specify the MIME Type of your file here type: "text/plain" }); // download the blob let url = window.URL.createObjectURL(blob); let a = document.createElement('a'); a.href = url; a.download = "Filename.txt"; a.click(); }); 的符号链接

如何解决这个问题?感谢所有帮助。

解决方法

如果问题仍然存在,则域末尾缺少斜杠:

    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/

另外,不要忘记启用代理模块:a2enmod proxy_http

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...