diff --git a/ai_web_common/rpc/core.py b/ai_web_common/rpc/core.py
index ba1bb3628b32c381dd082a2151fc2a412a09d866..7cc53ab4b4f0f9618cfdb4459f75eef3a212a0e1 100644
--- a/ai_web_common/rpc/core.py
+++ b/ai_web_common/rpc/core.py
@@ -139,7 +139,8 @@ def _json_request_encoder(req):
 
 
 def _json_response_decoder(resp):
-    if not resp.getheader('Content-Type').startswith('application/json'):
+    content_type = resp.getheader('Content-Type')
+    if not content_type or not content_type.startswith('application/json'):
         raise ValueError('response is not application/json')
 
     reader = codecs.getreader('utf-8')
@@ -264,12 +265,8 @@ class ClientStub():
                 pass
 
             actual_url = urllib3.util.Url(
-                parsed_url.scheme,
-                parsed_url.auth,
-                target_addr,
-                target_port,
-                parsed_url.path,
-                parsed_url.query,
+                path=parsed_url.path,
+                query=parsed_url.query,
             )
             resp = pool.urlopen(
                 'POST',
diff --git a/ai_web_common/rpc/test/__init__.py b/ai_web_common/rpc/test/__init__.py
index 91ea221844937cbbd64f0e19d5cbf80647a3c2f8..621c1d8abd05d549480b4939f6789b9af1525317 100644
--- a/ai_web_common/rpc/test/__init__.py
+++ b/ai_web_common/rpc/test/__init__.py
@@ -101,6 +101,10 @@ class HTTPWorker(threading.Thread):
 
         class _Handler(http.server.BaseHTTPRequestHandler):
             def do_POST(self):
+                if not self.path.startswith('/'):
+                    self.send_response(400)
+                    self.end_headers()
+                    return
                 counters.inc(key)
                 with request_counter_lock:
                     rc = request_counter['value']