Cannot send request from Postman via my IP - http

Strange thing - I have host API on localhost it works proper (via browser). It's a part of bigger project.
I use Postman for testing endpoints, and when I make request via localhost or 127:
-https://localhost:7257/esp32
-https://127.0.0.1:7257/esp32
Postman gives me Status 200 OK and fine data from API, but if I send request via my IP adress:
-https://192.168.8.xxx:7257/esp32 then I see error like this: Error: connect ECONNREFUSED 192.168.8.xxx:7257
What does it cause? Is it correct or no?

Ok, I need to host my application on the outside.

Related

HTTP message via browser

Is it possible to send a HTTP message to client via browser by typing
http://CLIENT_IP:PORT/MESSAGE
http://192.168.1.1:7777/HELLO
If so could you give me some link to such project or example code ?
Yes, it is, provided you have a http server listening on port 7777 of host 192.168.1.1 that will get your message and do something with it.
Yes, you will get the message as the route or path in the server. The specific variable will vary depending on the language and framework you’re using.

IISExpress with tunneling tool: The request hostname is invalid

I started a very simple ASP.net web api app. on port 8080.
I used ngrok as a tunneling tool to get a forwarding ip address:
Using postman I posted to the local server with the following request
http://ccf7e40b.ngrok.io/Bot/messages
and get the error: "HTTP Error 400. The request hostname is invalid.". However replacing the forwarding url with localhost:8080 would work.
I have seen several other posts with the same error messages get resolved by adding a binding line in Documents\IISExpress\config\appilcationHost.config to bind to a specific port. However I'm already running on 8080 port.
I'm using Visual Studio 2017.
You have to use modified hostheaders. So in your case, it should work with:
ngrok.exe http -host-header=rewrite localhost:8080

Postman: configuration with symfony

I am trying to use Postman to make some requests to my API and the problem is that always I get a 404 response even when the browser gives me a 200.
Here is my Postman request:
It's very confusing. How could I fix that? Is there a problem with Postman, my Apache, my PHP?
Working with xampp (PHP 7.1.1) and the desktop version of Postman.
Update #1:
The problem seems to be the Postman as it is sending the request via proxy even with that option disabled.
When I send a request to google.com.cu all works fine (it shouldn't be because my connection is behind a proxy and Postman don't know that config).
After that, I unplugged my network, and Postman was not been able to send more requests (all good for external requests) but not for my localhost.
Does Postman need an internet connection to send localhost requests?
Update #2:
The server browser response is OK (symfony welcome page).
I can see in your request that you don’t supply a port number, just localhost and then the route - Is this intentional?
You could try just localhost:<port>/<your_route>

Https communication on localhost in IIS using self-signed certificate

I have 2 sites running on the same machine, a client and an API.
Let's say the computer's IP is 10.10.10.10.
The API has a default page when you browse to it, the rest of the API is under 10.10.10.10/api.
The API has HTTP binding to port 80, and HTTPS binding to port 443.
The client has HTTP binding to port 8080, and HTTPS binding to port 64300.
Both HTTPS bindings use a self signed certificate I created via IIS manager.
Both sites have a HTTP to HTTPS redirect using "URL Rewrite".
When I try to browse either one of the apps, it works fine (gives the warning in the browser that you can skip).
When I do some action in the client which involves a HTTP request to the api using one of the following calls I get an error:
http://localhost/api/someMethod
http://localhost:80/api/someMethod
https://localhost/api/someMethod
https://localhost:443/api/someMethod
https://10.10.10.10/api/someMethod
The exception includes this error:
"The remote certificate is invalid according to the validation procedure"
I tried using the method described in this link (add the self-signed certificate to the Trusted Root Certificate Authorities folder) but it won't work.
Help please :D
found the answer.. posting if anyone else will get stuck on it.
It's pretty weird but the only thing that worked was to make the localhost http(s) request using the HOST NAME.
example:
https://the_name_of_the_computer:443/api/someMethod

Use JMeter HTTP Proxy to record JSON over HTTP request from not-a-browser client

I have a client program running locally in iPhone emulator and local server written in Java. Client talks to server with JSON over HTTP requests. Now I am trying to record a client session http requests with JMeter to use them as a base to load-test server.
The problem is client requests do not go throw JMeter proxy. Client gets 501 "Method not implemented" (it is not because of https, I am using http). There is nothing in JMeter log about the request, and obviously nothing gets recorded in JMeter and the request doesn't reach the server.
There is well-described steps to setup JMeter proxy to record request from a browser, but my client programm is not a browser. Though JSON over HTTP is widely adopted approach, I could not find anything on the web about recording such requests with JMeter. I understand I need to do on the client the same thing browser does when proxying request and what I've found about it is that I need to set Host header to server's host and port, but that did not work and I cannot see how is it related to 501 error client gets.
If someone can explain what should be done on client or how to configure JMeter to let it know where to proxy client's requests or link any manual explaining that, it would be great help. I've been searching for solution for a few hours already and had no luck. Please help.
You can see my question and the answer I got below:
Use Jmeter proxy to record HTTP calls from iOS simulator
In short:
With this tutorial you can record calls from your Android device:
http://blazemeter.com/blog/load-testing-mobile-apps-made-easy
For make same thing with iPhone, do the following steps:
Mac configuration:
system preferences -> Network -> Advanced.. -> Proxies -> check "Web Proxy (HTTP) ->in "Web Proxy Server" field, type your IP (http://www.wikihow.com/Find-Your-IP-Address-on-a-Mac), and choose available port (I using 8080) ->ok -> Apply
iPhone configuration:
Settings -> WiFi -> choose same wifi you use with your Mac -> press on it again to go to it's details -> scroll down ->In HTTP proxy, choose Manual -> server = your mac IP you found earlier -> port = the port you chosen (maybe 8080)
Now You can start recording all "iPhone network out" using jmeter recording controller

Resources