Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP request doesn't work on local network? #8

Open
FutureSkillz opened this issue Dec 14, 2023 · 3 comments
Open

HTTP request doesn't work on local network? #8

FutureSkillz opened this issue Dec 14, 2023 · 3 comments

Comments

@FutureSkillz
Copy link

This is a partial code snippet from my APIClient class. I have this method 'run' triggered by a button click.

The code is working for the first 'apiURL' variable for not for the 2nd which is my own locally running API. I know my local API is fine because I can hit it with Postman and my iPhone (same network).
Do you have any clue what might be happening? Thanks!

adamski::RestRequest request;
APIClient() : juce::Thread("APIClient Thread") {}
void run() override
{
	//juce::String apiUrl = "https://jsonplaceholder.typicode.com/todos/1"; //works
	juce::String apiUrl = "https://192.168.1.123:7031/get-single-anonymous"; //doesn't work

	auto response = request.get(apiUrl).execute();
	Logger::outputDebugString("response: " + response.bodyAsString);
}
@ruurdadema
Copy link

Does the server on your local network have SSL certificates set up?
Otherwise you probably want to use http instead of https.

@FutureSkillz
Copy link
Author

Yes it was the https! The moment I used http & port 5074 (the http port for my ASP .NET server) it worked, I was quite surprised haha.
I don't understand though, I'm able to hit that https endpoint in other languages like Javascript (after I setup CORS on server side) no issue.
You still think the solution is set up SSL certificates on server side?

@ruurdadema
Copy link

ruurdadema commented Dec 15, 2023

It depends on your use case. If you're developing and running a local server then SSL certificates might not be needed, but if you're sending things over internet, then it's probably very good practice to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants