Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Bug]: absproxy strips /absproxy/<port> from request path #5439

Unanswered
sergey-koryshev asked this question in Q&A
Discussion options

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

  1. open code-server
  2. create an empty angular application (no routing, SCSS)
  3. start it with command ng serve --disable-host-check
  4. 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

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

No response

You must be logged in to vote

Replies: 4 comments 12 replies

Comment options

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

You must be logged in to vote
1 reply
Comment options

Hmm /absproxy is not supposed to strip I believe (while /proxy does).

Comment options

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

You must be logged in to vote
0 replies
Comment options

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',
 },
 },
You must be logged in to vote
0 replies
Comment options

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

You must be logged in to vote
11 replies
Comment options

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 :)

Comment options

If the application has relative URLs anywhere the trailing slash would make a difference but otherwise either one should work in theory.

Comment options

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 :(

Comment options

I would check the Next.js docs for how to set a base path, and set it to /absproxy/4200.

Comment options

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
waiting-for-info Waiting for more information from submitter
Converted from issue

This discussion was converted from issue #5418 on August 10, 2022 17:48.

AltStyle によって変換されたページ (->オリジナル) /