Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Individual Proxy Setting needed #288

Closed
1 task done
kevinmatthe opened this issue Jan 3, 2023 · 8 comments · Fixed by #1031
Closed
1 task done

Individual Proxy Setting needed #288

kevinmatthe opened this issue Jan 3, 2023 · 8 comments · Fixed by #1031
Labels

Comments

@kevinmatthe
Copy link

Description

Firstly, please let me describe the situation I'm in.
I'm using k3s(you can just treat it as k8s), and I do need clash proxy to make my pods function well, including jellyseer establishing connection with imdb/tmdb.
But it costs a lot packing clash into every docker image I deploy, so I made a clash pod, using k8s DNS for each pod to get proxy like this:

export http_proxy=http://clash-pre-ix-chart.ix-clash-pre:7890
export https_proxy=http://clash-pre-ix-chart.ix-clash-pre:7890
...

It works properly most of the time.
However, in some application(like jellyseer), they use localhost for checking its own api's health. The env variables will cause all network going into clash pod, which don't know the so called localhsot is which address. And it lead it to clash pod's localhost. So the jellyseer cannot launch properly, the internal error log is like this:
[AxiosError: Request failed with status code 502]

{
  code: 'ERR_BAD_RESPONSE',
  config: {
    transitional: {
      silentJSONParsing: true,
      forcedJSONParsing: true,
      clarifyTimeoutError: false
    },
    adapter: [Function: httpAdapter],
    transformRequest: [ [Function: transformRequest] ],
    transformResponse: [ [Function: transformResponse] ],
    timeout: 0,
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    maxBodyLength: -1,
    env: { FormData: [Function] },
    validateStatus: [Function: validateStatus],
    headers: {
      Accept: 'application/json, text/plain, */*',
      'User-Agent': 'axios/0.27.2',
      host: 'localhost:10241'
    },
    method: 'get',
    url: 'http://localhost:10241/api/v1/settings/public',
    data: undefined
  },
  request: <ref *1> ClientRequest {
    _events: [Object: null prototype] {
      abort: [Function (anonymous)],
      aborted: [Function (anonymous)],
      connect: [Function (anonymous)],
      error: [Function (anonymous)],
      socket: [Function (anonymous)],
      timeout: [Function (anonymous)],
      prefinish: [Function: requestOnPrefinish]
    },
    _eventsCount: 7,
    _maxListeners: undefined,
    outputData: [],
    outputSize: 0,
    writable: true,
    destroyed: true,
    _last: true,
    chunkedEncoding: false,
    shouldKeepAlive: false,
    maxRequestsOnConnectionReached: false,
    _defaultKeepAlive: true,
    useChunkedEncodingByDefault: false,
    sendDate: false,
    _removedConnection: false,
    _removedContLen: false,
    _removedTE: false,
    _contentLength: 0,
    _hasBody: true,
    _trailer: '',
    finished: true,
    _headerSent: true,
    _closed: true,
    socket: Socket {
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: 'clash-pre-ix-chart.ix-clash-pre',
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 6,
      _maxListeners: undefined,
      _writableState: [WritableState],
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: null,
      _server: null,
      parser: null,
      _httpMessage: [Circular *1],
      write: [Function: writeAfterFIN],
      [Symbol(async_id_symbol)]: 1831,
      [Symbol(kHandle)]: null,
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kCapture)]: false,
      [Symbol(kSetNoDelay)]: false,
      [Symbol(kSetKeepAlive)]: true,
      [Symbol(kSetKeepAliveInitialDelay)]: 60,
      [Symbol(kBytesRead)]: 66,
      [Symbol(kBytesWritten)]: 173,
      [Symbol(RequestTimeout)]: undefined
    },
    _header: 'GET http://localhost:10241/api/v1/settings/public HTTP/1.1\r\n' +
      'Accept: application/json, text/plain, */*\r\n' +
      'User-Agent: axios/0.27.2\r\n' +
      'host: localhost:10241\r\n' +
      'Connection: close\r\n' +
      '\r\n',
    _keepAliveTimeout: 0,
    _onPendingData: [Function: nop],
    agent: Agent {
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      defaultPort: 80,
      protocol: 'http:',
      options: [Object: null prototype],
      requests: [Object: null prototype] {},
      sockets: [Object: null prototype],
      freeSockets: [Object: null prototype] {},
      keepAliveMsecs: 1000,
      keepAlive: false,
      maxSockets: Infinity,
      maxFreeSockets: 256,
      scheduling: 'lifo',
      maxTotalSockets: Infinity,
      totalSocketCount: 1,
      [Symbol(kCapture)]: false
    },
    socketPath: undefined,
    method: 'GET',
    maxHeaderSize: undefined,
    insecureHTTPParser: undefined,
    path: 'http://localhost:10241/api/v1/settings/public',
    _ended: true,
    res: IncomingMessage {
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 4,
      _maxListeners: undefined,
      socket: [Socket],
      httpVersionMajor: 1,
      httpVersionMinor: 1,
      httpVersion: '1.1',
      complete: true,
      rawHeaders: [Array],
      rawTrailers: [],
      aborted: false,
      upgrade: false,
      url: '',
      method: null,
      statusCode: 502,
      statusMessage: 'Bad Gateway',
      client: [Socket],
      _consuming: false,
      _dumped: false,
      req: [Circular *1],
      responseUrl: 'http://localhost:10241/api/v1/settings/public',
      redirects: [],
      [Symbol(kCapture)]: false,
      [Symbol(kHeaders)]: [Object],
      [Symbol(kHeadersCount)]: 4,
      [Symbol(kTrailers)]: null,
      [Symbol(kTrailersCount)]: 0,
      [Symbol(RequestTimeout)]: undefined
    },
    aborted: false,
    timeoutCb: null,
    upgradeOrConnect: false,
    parser: null,
    maxHeadersCount: null,
    reusedSocket: false,
    host: 'clash-pre-ix-chart.ix-clash-pre',
    protocol: 'http:',
    _redirectable: Writable {
      _writableState: [WritableState],
      _events: [Object: null prototype],
      _eventsCount: 3,
      _maxListeners: undefined,
      _options: [Object],
      _ended: true,
      _ending: true,
      _redirectCount: 0,
      _redirects: [],
      _requestBodyLength: 0,
      _requestBodyBuffers: [],
      _onNativeResponse: [Function (anonymous)],
      _currentRequest: [Circular *1],
      _currentUrl: 'http://localhost:10241/api/v1/settings/public',
      [Symbol(kCapture)]: false
    },
    [Symbol(kCapture)]: false,
    [Symbol(kNeedDrain)]: false,
    [Symbol(corked)]: 0,
    [Symbol(kOutHeaders)]: [Object: null prototype] {
      accept: [Array],
      'user-agent': [Array],
      host: [Array]
    },
    [Symbol(kUniqueHeaders)]: null
  },
  response: {
    status: 502,
    statusText: 'Bad Gateway',
    headers: { connection: 'close', 'content-length': '0' },
    config: {
      transitional: [Object],
      adapter: [Function: httpAdapter],
      transformRequest: [Array],
      transformResponse: [Array],
      timeout: 0,
      xsrfCookieName: 'XSRF-TOKEN',
      xsrfHeaderName: 'X-XSRF-TOKEN',
      maxContentLength: -1,
      maxBodyLength: -1,
      env: [Object],
      validateStatus: [Function: validateStatus],
      headers: [Object],
      method: 'get',
      url: 'http://localhost:10241/api/v1/settings/public',
      data: undefined
    },
    request: <ref *1> ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 7,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      destroyed: true,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      maxRequestsOnConnectionReached: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: false,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      _contentLength: 0,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      _closed: true,
      socket: [Socket],
      _header: 'GET http://localhost:10241/api/v1/settings/public HTTP/1.1\r\n' +
        'Accept: application/json, text/plain, */*\r\n' +
        'User-Agent: axios/0.27.2\r\n' +
        'host: localhost:10241\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: nop],
      agent: [Agent],
      socketPath: undefined,
      method: 'GET',
      maxHeaderSize: undefined,
      insecureHTTPParser: undefined,
      path: 'http://localhost:10241/api/v1/settings/public',
      _ended: true,
      res: [IncomingMessage],
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: 'clash-pre-ix-chart.ix-clash-pre',
      protocol: 'http:',
      _redirectable: [Writable],
      [Symbol(kCapture)]: false,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype],
      [Symbol(kUniqueHeaders)]: null
    },
    data: ''
  }
}

Version

1.3.0

Steps to Reproduce

When setting the proxy env, and the proxy is not on this server, it will reproduce.

Screenshots

No response

Logs

No response

Platform

desktop

Device

PC

Operating System

Debian 9

Browser

Edge

Additional Context

What I think can fix this problem properly is to make a way for user to set proxy for jellyseer's tmdb or other external api connection, like I've seen in some other applications.
Thanks a lot for your viewing and glad to help or discussion.

Code of Conduct

  • I agree to follow Overseerr's Code of Conduct
@Fallenbagel
Copy link
Owner

How are you setting up jellyseerr? Using localhost? 🤔

@kevinmatthe
Copy link
Author

How are you setting up jellyseerr? Using localhost? 🤔

nope... It's jellyseer's self healthcheck using localhost, I didn't modify that.

@kevinmatthe
Copy link
Author

#181 It's in fact the same problem with this closed issue.

@Fallenbagel
Copy link
Owner

Fallenbagel commented Jan 4, 2023

Have you tried exporting the no proxy env?

export http_proxy=http://clash-pre-ix-chart.ix-clash-pre:7890
export https_proxy=http://clash-pre-ix-chart.ix-clash-pre:7890
export no_proxy="localhost,127.0.0.1"

I used to do this exact thing on jellyfin before I got transparent proxy setup in router level. And my jellyfin health check would fail back then. Then I added the no_proxy and it started working

Not the solution to the exact the issue raised by worth a try as it might just solve the healthcheck thing

@kevinmatthe
Copy link
Author

Have you tried exporting the no proxy env?

export http_proxy=http://clash-pre-ix-chart.ix-clash-pre:7890
export https_proxy=http://clash-pre-ix-chart.ix-clash-pre:7890
export no_proxy="localhost,127.0.0.1"

I used to do this exact thing on jellyfin before I got transparent proxy setup in router level. And my jellyfin health check would fail back then. Then I added the no_proxy and it started working

Not the solution to the exact the issue raised by worth a try as it might just solve the healthcheck thing

You just taught me something new... Thanks and I'll try it.

@kevinmatthe
Copy link
Author

Great, it works~ I didn't know there's a env variable for no_proxy, I even tried on modifying /etc/hosts.. btw, thanks for your help

@Fallenbagel
Copy link
Owner

Great, it works~ I didn't know there's a env variable for no_proxy, I even tried on modifying /etc/hosts.. btw, thanks for your help

Glad to have been of help and you got it working! c:

@Fallenbagel
Copy link
Owner

🎉 This issue has been resolved in version 2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants