0

I have a REST API in go on my server VM, with gorilla/mux:

router := mux.NewRouter().StrictSlash(true)
log.Fatal(http.ListenAndServe(":49186", router))

I have an exposed IP and the domain forwarding set up on Godaddy as: [http://], [198.123.123.123:49186], Forward Type: Permanent (301), Settings: Forward Only

In my Kotlin I have:

val url = "http://example.com/getJSONitem/item%20name"
val q = Volley.newRequestQueue(this)
val request = JsonObjectRequest(Request.Method.Get, url, null, Response.Listener<JSONObject> { response ->
    textView.text = response.getString("Name")
    },
    Response.ErrorListener { error ->
        println(error)
})
q.add(request)

When I run this it hangs for a second and I get

I/System.out: com.android.volley.TimeoutError

BUT if I put the IP and port explicitly...

url = "http://198.123.123.123:49186/getJSONitem/item%20name"

...it works and I get my JSON object... At least that tells me that my server is listening. So it is either an issue with my Volley code or I have my DNS forwarding misconfigured, in which case this belongs on SE and I apologize. Thank you for reading.

P.S. I have also tried putting the port after the domain as follows, and receive the same timeout error.

url = "http://example.com:49186/getJSONitem/item%20name"
  • What is your domain name? What is the IP address your service listens on? ([Why we ask for real information](https://meta.serverfault.com/q/963/126632)) – Michael Hampton Feb 18 '21 at 23:33
  • My domain is wowahapp.com and the public IP is 35.193.69.215 and the port is 49155. I was troubleshooting earlier but just changed it back to having the port specified in the forwarding settings. I think it may take a minute to be effective. @MichaelHampton – craybobnee Feb 18 '21 at 23:50
  • I see `Hello World: Landing Page`. Are you still having a problem? – Michael Hampton Feb 18 '21 at 23:51
  • Yes, just re-confirmed. If I put the url http://wowahapp.com/getitem/Broken%20Fishing%20Pole/ in my browser it works, but in the android app I get volley.TimeoutError. If I use the more explicit http://35.193.69.215:49155/getitem/Broken%20Fishing%20Pole/ it works in both my browser and the app. @MichaelHampton – craybobnee Feb 18 '21 at 23:57
  • Looks like you're running into an issue with Kotlin rather than your server setup. You should follow this up on our sister site [so] which can help you debug your app. – Michael Hampton Feb 19 '21 at 00:02
  • I originally put it up there last night but no replies yet. I agree that the issue is something to do with the Kotlin and that is a more appropriate venue. Thank for your time. – craybobnee Feb 19 '21 at 00:05
  • You probably should add the real information to that post as well. – Michael Hampton Feb 19 '21 at 00:15

0 Answers0