Skip to content

Conversation

CumpsD
Copy link

@CumpsD CumpsD commented May 5, 2023

Right now all UI urls are based of /, which make it impossible to run coder behind a reverse proxy under a subpath (e.g. /coder/), as can be seen here:

image

Even though it seems from the documentation this should work: https://coder.com/docs/code-server/latest/guide#expose-code-server

image

Instead of Caddy, I am using Traefik, but this also has a strip prefix which I have configured:

image

I saw coder is being built with vite, which has an option to define a basepath: https://vitejs.dev/config/shared-options.html#base

Others have gone before me on StackOverflow, and found out that the default is / (as described in vite docs) causing these root paths, and in order to make it relative this needs to be ./: https://stackoverflow.com/questions/69744253/vite-build-always-using-static-paths/69746868#comment133768566_69746868

This PR configures the basepath so coder can run in any directory, whether it be root or subpath.

@github-actions
Copy link

github-actions bot commented May 5, 2023

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@CumpsD
Copy link
Author

CumpsD commented May 5, 2023

I have read the CLA Document and I hereby sign the CLA

@BrunoQuaresma BrunoQuaresma self-requested a review May 5, 2023 15:14
Copy link
Member

@kylecarbs kylecarbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has security implications running Coder on the same host as other applications.

Those applications could make requests inside workspaces because they'd share a cookie, which could lead to a whole set of security vulnerabilities.

What's the use-case you have in mind?

@CumpsD
Copy link
Author

CumpsD commented May 5, 2023

We have 1 domain with a cert (no wildcard) and run all our tools behind a reverse proxy using subpaths. We wanted to add coder as well but got stuck on the absolute paths

@CumpsD
Copy link
Author

CumpsD commented May 5, 2023

Small addition: cookies should have paths defined so they are not accessible to other apps

https://stackoverflow.com/a/8016137

@BrunoQuaresma BrunoQuaresma removed their request for review May 5, 2023 15:55
@CumpsD
Copy link
Author

CumpsD commented May 5, 2023

recheck

cdrcommunity added a commit to coder/cla that referenced this pull request May 5, 2023
@github-actions
Copy link

This Pull Request is becoming stale. In order to minimize WIP, prevent merge conflicts and keep the tracker readable, I'm going close to this PR in 3 days if there isn't more activity.

@github-actions github-actions bot added the stale This issue is like stale bread. label May 14, 2023
@github-actions github-actions bot closed this May 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale This issue is like stale bread.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants