Always prepend IP addresses with http for urls

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the web-development category.

Last Updated: 2024-11-21

In JavaScript I fetched against a Laravel backend endpoint 192.168.10.10/api/v1/login and it failed with 404.

But it worked when I added the protocol (http://192.168.10.10/api/v1/login)

As a general rule, always add the protocol before IP addresses. Some tools, like Chrome, might do this for you. But it's safest to go with the standard format for URLs.