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.

[Bug]: Port forwarding with suburl makes the forwarded links corrupted .

See original GitHub issue

Is there an existing issue for this?

OS/Web Information

  • Web Browser: Chrome (Version 98.0.4758.102) & Firefox (Version 102.3.0esr )
  • Local OS: Debian
  • Remote OS: Ubuntu
  • Remote Architecture: arm64
  • code-server --version: 4.8.3 977b853a1e162ab583aed64b1322d1515c57728c with Code 1.72.1

Steps to Reproduce

  1. Open code-server
  2. Run jupyter notebook in terminal , and forward the port (should be forwarded automatically)
  3. Open the forwarded url

Expected

Jupyter notebook shows up a correct UI and works without problems.

Actual

The jupyter notebook showed up with a unformatted UI (because css and js files are requested with a corrupted URL, only the https://192.168.0.114:28080/proxy/8888/login?next=%2Ftree is requested correctly) if logging in to the notebook it redirected me to https://192.168.0.114:28080/?next=/tree , which is obviously wrong (code-server is serving there) eg , for the logo.png , it requested for https://192.168.0.114:28080/static/base/images/logo.png?v=<a long string> , but it should request for https://192.168.0.114:28080/proxy/8888/static/base/images/logo.png?v=<a long string>

Logs

Logs
[IPC Library: Pty Host] DEBUG CommandDetectionCapability#handleCommandExecuted 0 1
[IPC Library: Pty Host] DEBUG CommandDetectionCapability#setCommandLine jupyter notebook
[IPC Library: Pty Host] TRACE IPty#onData [I 15:06:55.184 NotebookApp] Serving notebooks from local directory: /home/ubuntu/workspace

[IPC Library: Pty Host] TRACE IPty#onData [I 15:06:55.184 NotebookApp] Jupyter Notebook 6.5.2 is running at:
[I 15:06:55.184 NotebookApp] http://localhost:8888/?token=d5e6bd5bb2af22923a05edf7e2bb29171e26a5ea21988ac8
[I 15:06:55.184 NotebookApp]  or http://127.0.0.1:8888/?token=d5e6bd5bb2af22923a05edf7e2bb29171e26a5ea21988ac8
[I 15:06:55.184 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

[IPC Library: Pty Host] TRACE IPty#onData [C 15:06:55.197 NotebookApp] 

    To access the notebook, open this file in a browser:
        file:///home/ubuntu/.local/share/jupyter/runtime/nbserver-13720-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=d5e6bd5bb2af22923a05edf7e2bb29171e26a5ea21988ac8
     or http://127.0.0.1:8888/?token=d5e6bd5bb2af22923a05edf7e2bb29171e26a5ea21988ac8

[IPC Library: Pty Host] DEBUG ChildProcessMonitor: Has child processes changed true
[IPC Library: Pty Host] TRACE IPty#onData [I 15:07:03.317 NotebookApp] 302 GET / (127.0.0.1) 1.440000ms

[IPC Library: Pty Host] TRACE IPty#onData [I 15:07:03.407 NotebookApp] 302 GET /tree (127.0.0.1) 1.770000ms

[15:07:15] [<unknown>][29df24bf][ManagementConnection] The client has disconnected, will wait for reconnection 3h before disposing...
[15:07:17] [<unknown>][29df24bf][ManagementConnection] Another client has connected, will shorten the wait for reconnection 5m before disposing...
[15:07:17] [<unknown>][3473a0f6][ExtensionHostConnection] - startParams language: en
[15:07:17] [<unknown>][3473a0f6][ExtensionHostConnection] - startParams env: {"VSCODE_PROXY_URI":"https://192.168.0.114:28080/proxy/{{port}}/"}
[15:07:17] [<unknown>][3473a0f6][ExtensionHostConnection] The client has reconnected.
[15:07:17] [<unknown>][29df24bf][ManagementConnection] The client has reconnected.
[2022-11-18T15:07:21.474Z] debug 2 active connections
Trace: [2022-11-18T15:07:21.477Z] trace heartbeat
    at doLog (/home/ubuntu/code/code-server-4.8.3-linux-arm64/node_modules/@coder/logger/out/logger.js:57:28)
    at ServerFormatter.doWrite (/home/ubuntu/code/code-server-4.8.3-linux-arm64/node_modules/@coder/logger/out/logger.js:200:20)
    at ServerFormatter.write (/home/ubuntu/code/code-server-4.8.3-linux-arm64/node_modules/@coder/logger/out/logger.js:119:14)
    at Logger.handle (/home/ubuntu/code/code-server-4.8.3-linux-arm64/node_modules/@coder/logger/out/logger.js:339:25)
    at Logger.trace (/home/ubuntu/code/code-server-4.8.3-linux-arm64/node_modules/@coder/logger/out/logger.js:268:14)
    at Heart.<anonymous> (/home/ubuntu/code/code-server-4.8.3-linux-arm64/out/node/heart.js:41:29)
    at Generator.next (<anonymous>)
    at /home/ubuntu/code/code-server-4.8.3-linux-arm64/out/node/heart.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/home/ubuntu/code/code-server-4.8.3-linux-arm64/out/node/heart.js:4:12)
    at Heart.beat (/home/ubuntu/code/code-server-4.8.3-linux-arm64/out/node/heart.js:37:16)
    at /home/ubuntu/code/code-server-4.8.3-linux-arm64/out/node/heart.js:76:17
    at Generator.next (<anonymous>)
    at fulfilled (/home/ubuntu/code/code-server-4.8.3-linux-arm64/out/node/heart.js:5:58)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Screenshot/Video

Behavior

Run jupyter: image Forward port: image Access it: image

Browser console output

image

Explaination

The correct URL: image The corrupted URL: image

Does this issue happen in VS Code or GitHub Codespaces?

  • I cannot reproduce this in VS Code.
  • I cannot reproduce this in GitHub Codespaces.

Are you accessing code-server over HTTPS?

  • I am using HTTPS.

Notes

Code-server is running on a lxc container , it exposed the port 8888 to the server host , and I used iptables(iptables -t nat -A PREROUTING -p tcp --dport 28080 -j DNAT --to-destination 10.154.46.4:8080 , where 28080 is the server exposed port , and 10.154.46.4:8080 is the container exposed port). It is using a self-signed certificate with cert and cert-key params in the config file (not serving through nginx/caddy)

Also , this bug makes the pdf viewer from LaTeX workshop not working properly.

Is it because of relative path ? But jupyter and LaTeX workshop aren’t my project , i don’t know where I can make changes. Subdomains may work , but I don’t have a domain for my server.

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:20 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
code-ashercommented, Dec 6, 2022

Yeah I think for advanced proxy configuration it might be better to set up NGINX or Caddy instead of using code-server’s built-in.

Also if all you are looking for is to avoid stripping the base path then we have another proxy endpoint /absproxy for that so you could set VSCODE_PROXY_URI=https://my-domain.com/absproxy/{{port}}. It would be cool to have a way to choose between /proxy and /absproxy from the UI.

2reactions
jsjoeiocommented, Dec 5, 2022

Or something like a “help me” button that triggers a notification or opens documentation?

I like that! We could add a doc and then in the message that pops up about the forwarded port, add a link below and link to the docs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Forwarding from subdomain to port not working - Stack Overflow
no matter wheather I open domain oder subdomain.domain I'm always forwarded to domain:port. What am I doing wrong? Regards H.
Read more >
Don't auto-forward port on url link click, if it's already statically ...
I'm using the 'Remote - SSH' extension. Suppose I set up static forwarding in my local ~/.ssh/config: Host my_remote HostName my_remote.com ...
Read more >
Domain forwarding not working | GoDaddy Community
Domain forwarding not working. It worked for a while but now it will not forward to any website, when I visit my url...
Read more >
Why port forwarding feature is not working on my Wi-Fi router ...
Please follow the steps below for troubleshooting port forwarding failures on a TP-Link router. Step 1: Make sure the server is accessible ......
Read more >
Raspberry Pi Port Forwarding & Dynamic DNS - Pi My Life Up
In this guide I will take you through on how to set up Raspberry Pi port forwarding on the router and also setting...
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