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.

User-Agent Header not used for TLS tunnel

See original GitHub issue

In case where HTTP tunnel is needed, the “User-Agent” header is reset and the default agent “okhttp/3.x.x” is used. This is causing the request being ignored as its considered to be originating from an unknown client.

Reference code from RealConnection.

 /**
   * Returns a request that creates a TLS tunnel via an HTTP proxy, or null if no tunnel is
   * necessary. Everything in the tunnel request is sent unencrypted to the proxy server, so tunnels
   * include only the minimum set of headers. This avoids sending potentially sensitive data like
   * HTTP cookies to the proxy unencrypted.
   */
  private Request createTunnelRequest() throws IOException {
    return new Request.Builder()
        .url(route.address().url())
        .header("Host", Util.hostHeader(route.address().url(), true))
        .header("Proxy-Connection", "Keep-Alive")
        .header("User-Agent", Version.userAgent()) // For HTTP/1.0 proxies like Squid.
        .build();
  }

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
swankjessecommented, Jul 9, 2019

@JoshSolo you can hack this in with an Authenticator by following the instructions on pre-emptive authentication: https://square.github.io/okhttp/4.x/okhttp/okhttp3/-authenticator/#preemptive-authentication

0reactions
yschimkecommented, Mar 29, 2020

Won’t fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ETSI TS 124 109 V11.2.0 (2013-01)
The. User-Agent header field with GBA related "product" tokens shall be added to each outgoing HTTP request if the UE supports GBA-based authentication...
Read more >
Are HTTPS headers encrypted? - Stack Overflow
A browser will only use SSL/TLS if instructed to, unencrypted HTTP is used first. Usually, this will result in a redirect to the...
Read more >
HTTP Header Templates | ngrok documentation
This is empty for secure tunnels since there is no backend. Basic Auth Template Variables​. Note: These values are only available when using...
Read more >
user agent in http or https request - wireshark - Server Fault
yes ,. UA is the header field to do this , as all are saying and as you must be at the server...
Read more >
Sample Code Illustrating a Secure Socket Connection ...
getDefault(); /* * Set up a socket to do tunneling through the proxy. * Start it off as a regular socket, ... By...
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