mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-05-30 23:40:40 +02:00
[Bug]: docker use HTTP_PROXY env request error #839
Closed
opened 2026-04-24 23:23:17 +02:00 by adam
·
13 comments
No Branch/Tag Specified
master
book_tags_genres_dedupe
episode_download_fallback
Issue-4540-SortBy-StartedDate-and-FinishedDate
episode_meta_tagging
fix_authorize_race_condition
redirect_transcode_requests
progress_updated_sort
fix_ereader_socket_event
fix_change_empty_root_password
fix_podcast_session_track_index
fix_set_token
session_modal_user
localize_durations
fix_oidc_create_user
jwt_auth_refactor
fix_scanner_deleting_single_file_books
fix_mediaprogress_updatedat_2
experimental_next_client
podcast_episode_duration
episode-timestamps-clickable
book_author_secondary_sort_title
podcast_useragents
pathexists_user_access
fix_pathexists_join
book_author_secondary_sort
clean_duplicate_mediaprogress
sanitize_html_description
trix_prevent_attachments
check_path_api_fix
fix_mediaprogress_updatedat
increase_express_json_limit
fix_dockerfile_nunicode
search_episodes
audiobook_tools_update
episode_secondary_sorts
hls_stream_url_update
new_session_track_endpoint
audiobook_tools_enhancements
watcher_rescans_update
player_track_tooltip
fix_exclude_prefixes_crash
socket_item_events
fix_podcast_episode_scanner_promise
new_stats_controller
count_cache_for_userpermissions
parsing-opf-v3
validate_migration_files
fix-quick-match-all-crash
fix-chapter-end-sleep-timer
stringify_sequelize_query
remove-col-ambiguity
fix_next_prev_edit_description
details_trim_whitespace
fix_content_url_basepath
fix_logger_fatal
progress_bar_visibility
batch-edit-populate-map-details
feed_generator_updates
bookmark-modal-updates
migrate-library-item-in-scanner
migrate-new-library-items
migrate-podcasts-new-library-item-2
migrate-podcasts-new-library-item
fix-remove-episode-from-playlist
playback-session-use-new-library-item
refactor-library-item
fix-heatmap-caption
feed-episodes-upsert
share-media-player-media-session-api
remove-old-playlist
remove_old_collection_object
plugin-implementation-demo
feed_migration
refactor-feeds-from-item
fix_remove_authors_no_books
v2.17.3-fk-constraints-migration
migrations-first-upgrade
sqlite_2
feature/nuxt-target-server
waveform
s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
v1.3.4
v1.3.3
v1.3.1
v1.2.8
v1.2.6
v1.2.5
v1.2.4
v1.2.1
v1.1.15
v1.1.14
v1.1.13
v1.1.12
v1.1.11
v1.1.10
v1.1.9
v1.1.8
v1.0.0
0.9.61-beta.0
0.9.61-beta
Labels
Clear labels
authentication
backlog
bug
chapter editor
config-issue
ebooks
encoding/embedding
enhancement
help wanted
listening sessions & progress
planned
possible plugin
progress sync
pull-request
sorting/filtering/searching
unable to reproduce
upload
users & permissions
waiting
Mirrored from GitHub Pull Request
No Label
bug
Milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
adam (Adam Melkus)
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/audiobookshelf#839
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ilwzmf on GitHub (Dec 24, 2022).
Describe the issue
docker里配置了HTTP_PROXY和HTTPS_PROXY访问任何地址都报错
我需要使用代理才能访问google和部分podcasts
此代理在其他docker使用正常,同样的地址使用此代理在chrome访问正常
Sorry for the bad English, the following is google translation
HTTP_PROXY and HTTPS_PROXY are configured in docker to access any address and report an error
I need to use a proxy to access google and some podcasts
This proxy is used normally in other dockers, and the same address uses this proxy to access normally in chrome
Steps to reproduce the issue
请求已经到了代理服务器,但返回的都是错误,我不确定是否传的参数有问题
以下为log:
Failed Error: Request failed with status code 400
at createError (/node_modules/axios/lib/core/createError.js:16:15)
at settle (/node_modules/axios/lib/core/settle.js:17:12)
at IncomingMessage.handleStreamEnd (/node_modules/axios/lib/adapters/http.js:322:11)
at IncomingMessage.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1358:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
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,
validateStatus: [Function: validateStatus],
headers: {
Accept: 'application/json, text/plain, /',
'User-Agent': 'axios/0.26.1',
host: 'openlibrary.org'
},
method: 'get',
url: 'https://openlibrary.org//search.json?title=%E4%B8%89%E4%BD%93',
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)],
finish: [Function: requestOnFinish]
},
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
maxRequestsOnConnectionReached: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
strictContentLength: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
_closed: false,
socket: Socket {
connecting: false,
_hadError: false,
_parent: null,
_host: 'v2fly-uncn',
_closeAfterHandlingError: false,
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 7,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
parser: null,
_httpMessage: [Circular *1],
[Symbol(async_id_symbol)]: 55362,
[Symbol(kHandle)]: [TCP],
[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)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(RequestTimeout)]: undefined
},
_header: 'GET https://openlibrary.org//search.json?title=%E4%B8%89%E4%BD%93 HTTP/1.1\r\n' +
'Accept: application/json, text/plain, /\r\n' +
'User-Agent: axios/0.26.1\r\n' +
'host: openlibrary.org\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: 'https://openlibrary.org//search.json?title=%E4%B8%89%E4%BD%93',
_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: 400,
statusMessage: 'Bad Request',
client: [Socket],
_consuming: false,
_dumped: false,
req: [Circular *1],
responseUrl: 'https://openlibrary.org//search.json?title=%E4%B8%89%E4%BD%93',
redirects: [],
[Symbol(kCapture)]: false,
[Symbol(kHeaders)]: [Object],
[Symbol(kHeadersCount)]: 14,
[Symbol(kTrailers)]: null,
[Symbol(kTrailersCount)]: 0,
[Symbol(RequestTimeout)]: undefined
},
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'v2fly-uncn',
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: 'https://openlibrary.org//search.json?title=%E4%B8%89%E4%BD%93',
[Symbol(kCapture)]: false
},
[Symbol(kCapture)]: false,
[Symbol(kBytesWritten)]: 0,
[Symbol(kEndCalled)]: true,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype] {
accept: [Array],
'user-agent': [Array],
host: [Array]
},
[Symbol(kUniqueHeaders)]: null
},
response: {
status: 400,
statusText: 'Bad Request',
headers: {
'content-length': '264',
connection: 'keep-alive',
'content-type': 'text/html',
date: 'Sat, 24 Dec 2022 10:11:24 GMT',
'keep-alive': 'timeout=4',
'proxy-connection': 'keep-alive',
server: 'nginx/1.18.0 (Ubuntu)'
},
config: {
transitional: [Object],
adapter: [Function: httpAdapter],
transformRequest: [Array],
transformResponse: [Array],
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
validateStatus: [Function: validateStatus],
headers: [Object],
method: 'get',
url: 'https://openlibrary.org//search.json?title=%E4%B8%89%E4%BD%93',
data: undefined
},
request: <ref *1> ClientRequest {
_events: [Object: null prototype],
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
maxRequestsOnConnectionReached: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
strictContentLength: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
_closed: false,
socket: [Socket],
_header: 'GET https://openlibrary.org//search.json?title=%E4%B8%89%E4%BD%93 HTTP/1.1\r\n' +
'Accept: application/json, text/plain, /\r\n' +
'User-Agent: axios/0.26.1\r\n' +
'host: openlibrary.org\r\n' +
'Connection: close\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: nop],
agent: [Agent],
socketPath: undefined,
method: 'GET',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: 'https://openlibrary.org//search.json?title=%E4%B8%89%E4%BD%93',
_ended: true,
res: [IncomingMessage],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'v2fly-uncn',
protocol: 'http:',
_redirectable: [Writable],
[Symbol(kCapture)]: false,
[Symbol(kBytesWritten)]: 0,
[Symbol(kEndCalled)]: true,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype],
[Symbol(kUniqueHeaders)]: null
},
data: '<html>\r\n' +
'<head></head>\r\n' +
'\r\n' +
'
400 Bad Request
'
'
'\r\n' +
'</html>\r\n'
},
isAxiosError: true,
toJSON: [Function: toJSON]
}
[2022-12-24 18:11:24] ERROR: OpenLib Search Error 404
我在bash里可以正确访问,我将地址从https://openlibrary.org//search.json?title=%E4%B8%89%E4%BD%93改为了https://openlibrary.org/search.json?title=%E4%B8%89%E4%BD%93

见如下截图
Audiobookshelf version
v2.2.11
How are you running audiobookshelf?
Docker
@advplyr commented on GitHub (Dec 26, 2022):
I'm not sure what to do here so will need more information on specifically what needs to be done.
@ilwzmf commented on GitHub (Dec 27, 2022):
It's maybe a bug about axios.
Using the following code works fine.
It might be better to use unity interceptor.
const Axios = require("axios");
const HttpsProxyAgent = require("https-proxy-agent");
const httpsAgent = new HttpsProxyAgent(
http://${YOUR_HOST}:${YOUR_PORT});const axios = Axios.create({
proxy:false,
httpsAgent
})
@advplyr commented on GitHub (Dec 27, 2022):
What would "YOUR_HOST" and "YOUR_PORT" be in your example? How would Abs get that information? Why did you choose to use "http://" for the HttpsProxyAgent?
@ilwzmf commented on GitHub (Dec 28, 2022):
The environment variable HTTP_PROXY is common in most dockers.
Axios has automatically used the environment variable HTTP_PROXY, but axios has a bug when requesting https links through http proxy.
eg:HTTP_PROXY=http://192.168.1.2:9001
const httpsAgent = new HttpsProxyAgent(process.env.HTTP_PROXY);
I use v2fly, supports socks5 or http proxy.
After I tested, I found that axios may not support socks5.
@geekidentity commented on GitHub (Nov 12, 2023):
Has this issue been fixed?
@advplyr commented on GitHub (Nov 12, 2023):
I don't understand the issue so I added the help wanted tag
@geekidentity commented on GitHub (Nov 13, 2023):
@advplyr What he means is whether it can support the HTTP_PROXY and HTTPS_PROXY environment variables of the Linux system. This is required in the scenario of using VPN.
@ykelvis commented on GitHub (Jan 1, 2024):
Support for proxy would be very useful, as there are usecases where the host is behind firewall, requires some proxy setting to access internet.
@zhzy0077 commented on GitHub (Feb 26, 2024):
Looked into it in detail. 2 items on the way:
PR at #2666
@asseywang commented on GitHub (Mar 4, 2024):
I'm having the same problem, has this been resolved now?
[2024-03-04 13:49:55.073] ERROR: [podcastUtils] getPodcastFeed Error Error: Call to 10.1.1.1 is blocked. at agent.createConnection (/node_modules/ssrf-req-filter/lib/index.js:31:13) at Agent.createSocket (node:_http_agent:340:26) at Agent.addRequest (node:_http_agent:288:10) at new ClientRequest (node:_http_client:337:16) at Object.request (node:http:103:10) at RedirectableRequest._performRequest (/node_modules/follow-redirects/index.js:326:24) at new RedirectableRequest (/node_modules/follow-redirects/index.js:100:8) at Object.request (/node_modules/follow-redirects/index.js:532:14) at dispatchHttpRequest (/node_modules/axios/lib/adapters/http.js:262:25) at new Promise (<anonymous>) (podcastUtils.js:265)@advplyr commented on GitHub (Jan 1, 2025):
Another env variable is being added in the next release
EXP_PROXY_SUPPORTas a workaround to this issue.See https://github.com/advplyr/audiobookshelf/pull/3754
@github-actions[bot] commented on GitHub (Jan 1, 2025):
Fixed in v2.17.7.
@seancheung commented on GitHub (Jun 2, 2025):
I'm still getting this error. It seems to be caused by
axios. Here is my solution:create an
axios.jsfile:patch axios module with the above file:
This patch disables axios's default proxy detection and uses
https-proxy-agentinstead. It should work well with https requests over http proxy.I don't know if this should be patched by audiobookshelf itself. @advplyr