Sometimes the backend APIs which you are trying to test with frontend aren't ready yet. So you'll see
DNS_PROBE_FINISHED_NXDOMAIN error when you try to hit these endpoints from frontend. This happens because you're trying to access a “non-existent domain” which DNS probe could not find the matching IP for.
One way you can solve this is by using by using Mock Server. But this solution faces some drawbacks:
- Changing the backend url in your codebase.
- CORS errors
Solution: Requestly Way
Requestly lets you modify the response of the
Non Existent Urls without changing anything in your codebase. Here are the steps:
- Install Requestly Browser Extension or Desktop App.
- Start creating a Modify Response Rule here.
- Enter the non-existent url in the Source Field. Eg. https://non-existent-url.com
- Enter Response Status that you want to return (By default it returns 404 if you leave it empty).
- Enter Response Body that needs to be returned. You can either enter
Static Bodyor return body
That's it. Now you can keep on working on your frontend until your backend APIs are ready :D
If you want to add some
Response Headerstoo, you can do that by creating
Headers Rulein Requestly.