Conversation
|
Any chance this small fix can be merged? |
|
Unfortunately, there doesn't seem to be a way to test this change as described in #221345: I tried getting a testing environment on
|
This comment was marked as spam.
This comment was marked as spam.
dredwilliams
left a comment
There was a problem hiding this comment.
This is a simple change that appears to address the issue without having any other impacts
lost-in-dev-null
left a comment
There was a problem hiding this comment.
An easy fix for an annoying issue. I see no reason why not to merge.
|
When you start the server with Why does the proxy forward the request to '/', but not '/server-base-path' ? |
This is just the way how most proxies are configured for simplicity and often end-users can't control this. The server base path is just needed as a prefix for absolute links, not for actually serving files from that path. |
|
Trying to explain why most proxies use the explained approach: For which use-case would one use a different base path? When one wants to serve multiple instances or different services on a single host or domain. How do you distribute traffic in this case? You run a proxy and forward requests based on some rules to other services usually differentiated by a different local port on the host. As each service instance is only serving one instance, there is no use of using a different base path there but absolute links need to contain the correct prefix such that they work correctly. This is why basically every service using absolute links is offering some way to specify the prefix used to construct the links. |
|
We are trying to integrate code into an existing application that proxies requests into the code server with the base-path intact ... not our choice. The expectation is that the code server will take the base-path into consideration when interpreting HTTP requests, and include that base-path on any referral links. I thought that was what the base-path parameter was for ... |
|
As mentioned, the idea of |
|
Also, I'd like to learn more about that existing application that proxies requests into the code server |
|
We would love to add VSCode as a webapp to our portal so that VSCode can run at a dynamically generated suburl which is different for each user session but not known before the user has logged in. So VSCode needs to be able to run behind a dynamically configurable proxy. |
|
@aeschli - The the application is Open OnDemand, a web platform for accessing HPC resources. It encapsulates an Apache web server and an NGINX application server to launch applications and drive a point-and-click interface for users. It can launch applications that offer an HTML interface by proxying the connections through a dynamic path custom to each user and application. That keeps all web traffic going through the same session with the user. In this scenario, when the user wants to launch VS Code, we will build the unique path for that user's instance and provide that path via the base-path parameter. We don't care that it can't respond to the default '/' path -- in fact, that's a desired impact when multiple users may be launching their own sessions on the same system. Each user will have their own 'code serve-web' session with their unique base-path |
Serving from both paths sounds like a great idea to cover all use cases. |
|
There is no need for the added complexity of responding to BOTH / and base-path ... if the base-path parameter is set, responding to '/' is not the desired behavior FOR THAT INSTANCE. |
As a lot of people explained including myself, responding only to '/' is the desired behavior for most proxy use cases. Serving on both should maintain compatibility with other use cases. |
|
I think I got it fixed to serve from both, root and base path. I basically remove the base path when the server receives the request and add it for the client. |
|
This approach allowed me to honor |
@dredwilliams Each |
|
This looks great -- thanks for the effort y'all put into this! |
lost-in-dev-null
left a comment
There was a problem hiding this comment.
Think this will make a lot of people happy! Thanks for the effort!
|
@aeschli could you please take another look? Thanks! |
This allows determining the base path automatically if set correctly by the proxy.
|
This capability would be useful to many---perhaps most---computing centers that use Open OnDemand to provide web access to their computing resources. |
|
This capability should also enable users to run VS Code on Kubeflow. It would be great to get a release with this PR merged soon. |
|
Is this still relevant? |
Yes, many people are eagerly waiting for this to get merged! |
|
+1 from me. |
See #210399 for the motivation.
Commits:
/and basePathX-Forwarded-PrefixheaderX-Forwarded-PortheaderTest procedure:
yarn compilescripts/code-server.shFixes #210399, #225706