我正在使用邮递员测试我拥有的 API,当请求不包含子域时一切都很好,但是当我将子域添加到 URL 时,我得到了这个响应.
无法得到任何回应
连接到
关闭常规标签中的SSL证书验证:将请求超时设为 0(零)配置Apache
:
如果上述更改导致 404
响应,则继续阅读;-)
在本地托管其网站的用户(例如使用 XAMP
和/或 WAMP
)可以使用 https://访问他们的虚拟网站
前缀地址,但这是一个谎言,真正启用 SSL
(对于每个虚拟站点),配置 Apache 如下:
在您喜欢的文本中打开 httpd-vhosts.conf
文件(来自 Apache
的 conf/extras
目录)-编辑.
将虚拟站点的设置更改为:
<VirtualHost *:80 *:443>服务器名称 my-site.local服务器别名 *.my-site.localDocumentRoot "C:xampphtdocsmy-projectpublic"SSLEngine 开启SSLCertificateFile "path/to/my-generated.cert"SSLCertificateKeyFile "path/to/my-generated.key"SetEnv APPLICATION_ENV "开发";<目录C:xampphtdocsmy-projectpublic">选项索引 FollowSymLinks允许覆盖所有命令允许,拒绝允许所有人</目录></虚拟主机>
当然,生成一个虚拟 SSL 证书,并更改所有文件路径,例如从path/to/my-generated.cert
"进入真实的文件地址.
最后,在浏览器中访问本地站点进行测试,但使用http://
(不带S)前缀地址;Apache 现在应该给出如下错误:
错误请求您的浏览器发送了此服务器无法理解的请求.原因:您对启用 SSL 的服务器端口使用纯 HTTP.请改用 HTTPS 方案访问此 URL.
I am using postman to test an API I have, all is good when the request does not contain sub-domain, however when I add a sub-domain to URL I am getting this response.
Could not get any response
There was an error connecting to http://subdomain.localhost:port/api/
Why this might have happened:
The server couldn't send a response:Ensure that the backend is working properly
Self-signed SSL certificates are being blocked:Fix this by turning off 'SSL certificate verification' in Settings > General
Proxy configured incorrectly Ensure that proxy is configured correctly in Settings > Proxy
Request timeout:Change request timeout in Settings > General
If I copy the same URL from postman and paste it into the browser I get a proper response, is there some kind of configurations I should do to make postman work with sub-domains?
解决方案First Go to Settings in Postman:
Off the SSL certificate verification in General Tab: Off the Global Proxy Configuration and Use System Proxy in Proxy Tab: Make Request Timeout to 0 (Zero)Configure Apache
:
If above changes resulted in 404
response, then continue reading ;-)
Users that host their site locally (like with XAMP
and/or WAMP
), may be able to visit their virtual-sites using https://
prefixed address, but it's a lie, and to really enable SSL
(for each virtual-site), configure Apache like:
Open httpd-vhosts.conf
file (from Apache
's conf/extras
directory), in your preferred text-editor.
Change virtual-site's settings, into something like:
<VirtualHost *:80 *:443>
ServerName my-site.local
ServerAlias *.my-site.local
DocumentRoot "C:xampphtdocsmy-projectpublic"
SSLEngine on
SSLCertificateFile "path/to/my-generated.cert"
SSLCertificateKeyFile "path/to/my-generated.key"
SetEnv APPLICATION_ENV "development"
<Directory "C:xampphtdocsmy-projectpublic">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
But of course, generate a dummy-SSL-certificate, and change all file-paths, like from "path/to/my-generated.cert
" into real file-addresses.
Finally, test by visiting local-site in browser, but using http://
(without S) prefixed address; Apache should now give error like:
Bad Request
Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.
相关推荐
最新文章