question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to send a request to a service proxy

See original GitHub issue

I’m trying to make a post request via the proxy API to a service without the k8s cluster without much luck. Found the below candidate API -

connect_post_namespaced_service_proxy
connect_post_namespaced_service_proxy_with_path
proxy_post_namespaced_service
proxy_post_namespaced_service_with_path

But was unable to attach a body (or extra headers to them):

  • Can anyone point to examples or documentation on how to do this?
  • What is the difference between the plain & _with_path APIs (the documentation for bot?
connect_post_namespaced_service_proxy:
       :param str path: Path is the part of URLs that include service endpoints, suffixes, and parameters to use for the current proxy request to service. For example, the whole request URL is http://localhost/api/v1/namespaces/kube-system/services/elasticsearch-logging/_search?q=user:kimchy. Path is _search?q=user:kimchy.

connect_post_namespaced_service_proxy_with_path:
       :param str path2: Path is the part of URLs that include service endpoints, suffixes, and parameters to use for the current proxy request to service. For example, the whole request URL is http://localhost/api/v1/namespaces/kube-system/services/elasticsearch-logging/_search?q=user:kimchy. Path is _search?q=user:kimchy.
  • What is the difference between the two sets of APIs?
connect_post_XXX
proxy_post_XXX

Thanks!

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:39 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
roycaihwcommented, Sep 24, 2019

/remove-lifecycle rotten

What is the difference between the plain & _with_path APIs

I believe those work the same. Kubernetes apiserver allows the request to specify the subpath that you want to connect to either through a query parameter or by directly composing the URL path. Those two APIs reflect the options that the openapi spec gives.

What is the difference between the two sets of APIs?

connect_post_XXX
proxy_post_XXX

the proxy_* methods are deprecated and removed, use connect_* instead

was unable to attach a body (or extra headers to them)

the upstream openapi spec needs to be fixed so that this client library can support writing body and additional headers. I will take a stab

1reaction
makkuscommented, Jan 8, 2020

@jbyers19 as a workaround, you could use the ‘call_api’ method directly, sorta like:

path_params = {
        "name": "https:argocd-server:443",
        "namespace": "default",
        "path": "api/v1/session"
    }

body = {
        "username": "admin",
        "password": "password"
    }

response = v1.api_client.call_api(
            '/api/v1/namespaces/{namespace}/services/{name}/proxy/{path}', 'POST',
            path_params,
            [],
            {"Accept": "*/*"},
            body=body,
            post_params=[],
            files={},
            response_type='str',  
            auth_settings=["BearerToken"],
            async_req=False,
            _return_http_data_only=True, 
            _preload_content=True,
            _request_timeout=None,
            collection_formats={})

I’m using the async python client, but this should work with the sync one too I’d guess.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to establish Web Service proxy error — oracle-tech
Caused by: Unable to establish Web Service proxy. ... SOAPException: Message send failed: Connection refused; javax.xml.soap.
Read more >
Error 'Failed to send request' or unable to login with Data Loader
Check if your network is using a proxy - Getting the error message, "Failed to send request to https://www.salesforce.com/services/Soap/u/31.0" typically ...
Read more >
How to Solve Proxy Error Codes - The Ultimate Guide!
A proxy error is an HTTP error status that you will receive as a response when a request sent to the web server...
Read more >
I am having trouble sending requests - Postman
Make sure you have enabled the custom proxy option within Postman. I can't send any requests through Postman. My network does not need...
Read more >
Can't consume web services via an HTTP proxy server - .NET ...
To resolve this problem, supply the proper proxy configuration settings to the .NET client. The following are the default settings in the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found