-
Notifications
You must be signed in to change notification settings - Fork 6.3k
[Bug]: absproxy strips /absproxy/<port> from request path #5439
-
Is there an existing issue for this?
- I have searched the existing issues
OS/Web Information
- Web Browser: Chrome
- Local OS: Windows 11
- Remote OS: Raspbian GNU/Linux 11 (bullseye)
- Remote Architecture: ARM
code-server --version: 4.5.1
Steps to Reproduce
- open code-server
- create an empty angular application (no routing, SCSS)
- start it with command
ng serve --disable-host-check - open link
<code-server-path>/absproxy/4200
Expected
Application is correctly opened in browser
Actual
Application is not opened in browser properly because of absproxy still strips /absproxy/<port> from request path (but docs says that absproxy will keep /absproxy/<port>)
Logs
No response
Screenshot/Video
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
No response
Beta Was this translation helpful? Give feedback.
All reactions
-
👀 1
Replies: 4 comments 12 replies
-
absproxy still strips /absproxy/ from request path
I believe this behavior is expected (cc @code-asher to confirm).
I am guessing you need to configure a proxy similar to how people do it for React/Vue
Beta Was this translation helpful? Give feedback.
All reactions
-
Hmm /absproxy is not supposed to strip I believe (while /proxy does).
Beta Was this translation helpful? Give feedback.
All reactions
-
👀 2
-
absproxy still strips /absproxy/ from request path
I believe this behavior is expected (cc @code-asher to confirm).
I am guessing you need to configure a proxy similar to how people do it for React/Vue
I will appreciate it if you can help me to figure out how to set up correct proxy for angular app
Beta Was this translation helpful? Give feedback.
All reactions
-
Sadly I've never used Angular so I wouldn't be much help. I'd read the Angular guide and give that a try.
Maybe something like:
devServer: { proxy: { '/': 'http://localhost:8080/absproxy/4200', }, },
Beta Was this translation helpful? Give feedback.
All reactions
-
I tried to use this proxy configuration but its behavior is odd:
{
"/": {
"target": "http://localhost:8080/absproxy/4200",
"logLevel": "debug"
}
}Logs:
[HPM] GET /absproxy/4200 -> http://localhost:8080/absproxy/4200
[HPM] GET /absproxy/4200/absproxy/4200 -> http://localhost:8080/absproxy/4200
[HPM] GET /absproxy/4200/absproxy/4200/absproxy/4200 -> http://localhost:8080/absproxy/4200
[HPM] GET /absproxy/4200/absproxy/4200/absproxy/4200/absproxy/4200 -> http://localhost:8080/absproxy/4200
[HPM] GET /absproxy/4200/absproxy/4200/absproxy/4200/absproxy/4200/absproxy/4200 -> http://localhost:8080/absproxy/4200
[HPM] GET /absproxy/4200/absproxy/4200/absproxy/4200/absproxy/4200/absproxy/4200/absproxy/4200 -> http://localhost:8080/absproxy/4200
...
[HPM] GET /absproxy/4200/absproxy/4200/absproxy/4200/absproxy/4200/absproxy/4200/absproxy/4200/absproxy/4200/absproxy/4200/absproxy/4200/absproxy/4200/absproxy/4200/absproxy/4200/absproxy/4200/absproxy/4200/absproxy/4200/absproxy/4200/absproxy/4200/absproxy/4200/absproxy/4200/absproxy/4200 -> http://localhost:8080/absproxy/4200
Due to a lot of the redirections my request fails with error ERR_TOO_MANY_REDIRECTS in browser
Beta Was this translation helpful? Give feedback.
All reactions
-
Yes! I don't know why the trailing slash is required 🤔 @code-asher might. But yes, feel free to add to the docs or I can next week!
Happy we figured it out :)
Beta Was this translation helpful? Give feedback.
All reactions
-
If the application has relative URLs anywhere the trailing slash would make a difference but otherwise either one should work in theory.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
Would you guys have advise on how to get this to work with a nx generated nextjs app? <code-server-host.com>/absproxy/4200 just returns 404 not found :(
Beta Was this translation helpful? Give feedback.
All reactions
-
I would check the Next.js docs for how to set a base path, and set it to /absproxy/4200.
Beta Was this translation helpful? Give feedback.
All reactions
-
Magic! It works perfectly. The only thing I'd mention: trailing slash in
https://localhost:8080/absproxy/4200/is required to get it work.I think your fix is need to be placed in docs somewhere under Accessing web services
Thank you for your help 🙂
When accessing your app this way, are you able to get a step debugger in VSCode?
Beta Was this translation helpful? Give feedback.