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:
Apache
:If the above changes resulted in a 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 the virtual site's settings, into something like:
<VirtualHost *:80 *:443>
ServerName my-site.local
ServerAlias *.my-site.local
DocumentRoot "C:\xampp\htdocs\my-project\public"
SSLEngine on
SSLCertificateFile "path/to/my-generated.cert"
SSLCertificateKeyFile "path/to/my-generated.key"
SetEnv APPLICATION_ENV "development"
<Directory "C:\xampp\htdocs\my-project\public">
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.
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.