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

user abs-proxy-base-path config have problem #7125

Open
1 of 2 tasks
YZPAWE opened this issue Dec 18, 2024 · 2 comments
Open
1 of 2 tasks

user abs-proxy-base-path config have problem #7125

YZPAWE opened this issue Dec 18, 2024 · 2 comments
Labels
bug Something isn't working triage This issue needs to be triaged by a maintainer

Comments

@YZPAWE
Copy link

YZPAWE commented Dec 18, 2024

Is there an existing issue for this?

  • I have searched the existing issues

OS/Web Information

I am using the abs-proxy-base-path configuration of code-server and have set up a proxy with Nginx. However, when accessing http://nginxIP:port/code/, it shows "not found". Below is my configuration:

location ~ ^/code/ {
set $upstream "";

rewrite_by_lua_block {
    local code = package.loaded.code
    code.direct_to_code(ngx)
}
log_by_lua_block {
    ngx.log(ngx.DEBUG, "Upstream value: " .. tostring(ngx.var.upstream))
}

proxy_set_header Host $http_host;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://$upstream;

error_page 500 501 502 503 504 506 = /loading.html;

}
Configuration for code-server:

bind-addr: 0.0.0.0:8155
auth: none
cert: false
abs-proxy-base-path: https://tide-test.com/
verbose: true

Image

Steps to Reproduce

Expected

help me reslove this issue

Actual

404

Logs

[2024-12-18T08:11:47.109Z] info  code-server 4.95.2 fc97e248c354be27a054c182669a6984dd73cd41
[2024-12-18T08:11:47.109Z] info  Using user-data-dir /home/work/.local/share/code-server
[2024-12-18T08:11:47.109Z] debug Using extensions-dir /home/work/.local/share/code-server/extensions
[2024-12-18T08:11:47.122Z] info  Using config file /home/work/.config/code-server/config.yaml
[2024-12-18T08:11:47.122Z] info  HTTP server listening on http://0.0.0.0:8155/
[2024-12-18T08:11:47.122Z] info    - Authentication is disabled
[2024-12-18T08:11:47.122Z] info    - Not serving HTTPS
[2024-12-18T08:11:47.122Z] info  Session server listening on /home/work/.local/share/code-server/code-server-ipc.sock
[2024-12-18T08:11:58.687Z] debug heartbeat
[16:11:58] Remote configuration data at /home/work/.local/share/code-server
[16:11:58] process arguments: {
  'bind-addr': '0.0.0.0:8155',
  auth: 'none',
  'abs-proxy-base-path': 'https://tide-test.com/code/',
  verbose: true,
  config: '/home/work/.config/code-server/config.yaml',
  'user-data-dir': '/home/work/.local/share/code-server',
  'extensions-dir': '/home/work/.local/share/code-server/extensions',
  'session-socket': '/home/work/.local/share/code-server/code-server-ipc.sock',
  log: [ 'trace' ],
  host: '0.0.0.0',
  port: '8155',
  'proxy-domain': [],
  _: [],
  usingEnvPassword: false,
  usingEnvHashedPassword: false,
  help: false,
  version: false,
  'accept-server-license-terms': true,
  compatibility: '1.64',
  'without-connection-token': true,
  'builtin-extensions-dir': '/usr/lib/code-server/lib/vscode/extensions',
  logsPath: '/home/work/.local/share/code-server/logs/20241218T161158'
}
[16:11:58] 




[16:11:58] [File Watcher (node.js)] Request to start watching: /home/work/.local/share/code-server/Machine (excludes: <none>, includes: <all>, filter: <none>, correlationId: <none>),/home/work/.local/share/code-server/Machine/settings.json (excludes: <none>, includes: <all>, filter: <none>, correlationId: <none>)
[16:11:58] [File Watcher (node.js)] Started watching: '/home/work/.local/share/code-server/Machine'
[16:11:58] [File Watcher (node.js)] ignoring a path for watching who's stat info failed to resolve: /home/work/.local/share/code-server/Machine/settings.json (error: Error: ENOENT: no such file or directory, stat '/home/work/.local/share/code-server/Machine/settings.json')
[16:11:58] [File Watcher (node.js)] starting fs.watchFile() on /home/work/.local/share/code-server/Machine/settings.json (correlationId: undefined)
[16:11:58] ExtensionManagementService#cleanUp
[16:11:58] ExtensionManagementService#removeTempDeleteFolders
[16:11:58] Extension host agent started.
[16:11:58] Extension VSIX downloads cache dir does not exist
[16:11:58] [File Watcher (node.js)] Request to start watching: /home/work/.local/share/code-server/extensions (excludes: <none>, includes: <all>, filter: <none>, correlationId: <none>)
[16:11:58] [File Watcher (node.js)] Request to stop watching: /home/work/.local/share/code-server/Machine/settings.json (excludes: <none>, includes: <all>, filter: <none>, correlationId: <none>)
[16:11:58] [File Watcher (node.js)] stopping file watcher (/home/work/.local/share/code-server/Machine/settings.json (excludes: <none>, includes: <all>, filter: <none>, correlationId: <none>))
[16:11:58] Removing uninstalled extensions: [ 'baidu.comate-2.3.12' ]
[16:11:58] Started scanning user extensions gr {
  scheme: 'file',
  authority: '',
  path: '/home/work/.local/share/code-server/extensions',
  query: '',
  fragment: '',
  _formatted: 'file:///home/work/.local/share/code-server/extensions',
  _fsPath: '/home/work/.local/share/code-server/extensions'
}
[16:11:58] [File Watcher (node.js)] Request to start watching: /home/work/.local/share/code-server/extensions/extensions.json (excludes: <none>, includes: <all>, filter: <none>, correlationId: <none>)
[16:11:58] Started scanning user extensions gr {
  scheme: 'file',
  authority: '',
  path: '/home/work/.local/share/code-server/extensions',
  query: '',
  fragment: '',
  _formatted: 'file:///home/work/.local/share/code-server/extensions',
  _fsPath: '/home/work/.local/share/code-server/extensions'
}
[16:11:58] [File Watcher (node.js)] Started watching: '/home/work/.local/share/code-server/extensions'
[16:11:58] [File Watcher (node.js)] Started watching: '/home/work/.local/share/code-server/extensions/extensions.json'
[16:11:58] Scanned user extensions: 14
[16:11:58] Scanned user extensions: 13
[2024-12-18T08:12:58.689Z] debug 0 active connections

Screenshot/Video

No response

Does this bug reproduce in native VS Code?

Yes, this is also broken in native VS Code

Does this bug reproduce in GitHub Codespaces?

Yes, this is also broken in GitHub Codespaces

Are you accessing code-server over a secure context?

  • I am using a secure context.

Notes

No response

@YZPAWE YZPAWE added bug Something isn't working triage This issue needs to be triaged by a maintainer labels Dec 18, 2024
@code-asher
Copy link
Member

code-asher commented Dec 18, 2024

abs-proxy-base-path is for code-server's internal proxy for proxying web apps (accessible via /absproxy/$portnumber), but it does not have anything to do with NGINX proxying to code-server, if that makes sense.

Is your NGINX config rewriting the path? code-server expects that when you serve at a sub-path that the sub-path gets rewritten to just /. Usually with NGINX this is accomplished by adding a trailing slash (proxy_pass http://localhost:8080/; for example) but I am not sure what this Lua block is doing.

@code-asher
Copy link
Member

Wait I am dumb, missed the proxy_pass. Try proxy_pass http://$upstream/;.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage This issue needs to be triaged by a maintainer
Projects
None yet
Development

No branches or pull requests

2 participants