首页 > 解决方案 > 是否可以将 https 请求重定向到 http 端点?

问题描述

我需要测试一个应用程序。它是一个使用其他 API 的微服务。为了单独测试它,我想使用模拟服务器。问题是我无法将被测应用程序配置为向 http 模拟服务器发送请求。它仅使用 https 协议和端口 443 发送请求。但是,该端口上没有运行 https-app。但是可以指定代理服务器。我试图将 apache 配置为作为 https 代理服务器运行。此服务器使用 localhost 域的自签名证书。但是重定向不适用于 https 请求。但是,如果我在 http 模式下运行代理服务器,http 请求会成功重定向。这是代理服务器的配置:

<VirtualHost localhost:8098>
        ProxyRequests Off
        SSLEngine On

        ProxyPass        / http://localhost:3001
        ProxyPassReverse / http://localhost:3001

        SSLCertificateFile localhost.crt
        SSLCertificateKeyFile localhost.key
</VirtualHost>```

标签: apacheapitestingproxy

解决方案


推荐阅读