问题描述
我正在尝试设置一个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