Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying an HTTP path for ports defined in .gitpod.yml #10405

Open
juliusv opened this issue Jun 1, 2022 · 5 comments
Open

Allow specifying an HTTP path for ports defined in .gitpod.yml #10405

juliusv opened this issue Jun 1, 2022 · 5 comments

Comments

@juliusv
Copy link

juliusv commented Jun 1, 2022

It's great that I can define ports in the .gitpod.yml that are automatically opened in a new browser tab when they become available. For some ports it would be helpful to be able to additionally specify a path to open, since the root path does not always serve something. For example, I have some Prometheus instrumentation examples in https://github.com/promlabs/instrumentation-examples that only serve something on /metrics, not on /.

@stale
Copy link

stale bot commented Sep 9, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the meta: stale This issue/PR is stale and will be closed soon label Sep 9, 2022
@juliusv
Copy link
Author

juliusv commented Sep 10, 2022

Staleness prevention bump :)

@stale stale bot removed the meta: stale This issue/PR is stale and will be closed soon label Sep 10, 2022
@axonasif axonasif added the meta: never-stale This issue can never become stale label Sep 12, 2022
@ChevronTango
Copy link

Often when exposing ports using gitpod and having services and UIs working in tandem we see CORS issues cropping up. In production these aren't an issue as the API and UI are hosted on the same domain with nginx doing the routing based on path, eg /api/ is routed to a particular api server. In gitpod we can only expose unique domains. This causes CORS issues that the user then has to debug and resolve when the UI domain does not match the API domain.

A way to optionally customize certain ports to instead be exposed at ports-my-gitpod-workspace.gitpod.io/some-custom-path/ to allow more representative testing.

I can see some users wanting to host a ui at / and an API at /api/ as the most common example

Many users take to standing up an nginx server locally, but this can be cumbersome and difficult to manage or keep up to date. It would be much nicer if gitpod was able to do at least the simple path routing on the users behalf.

This is mostly to make dev of complex multi component applications easier and more representative of the production environment they will eventually move into. CORS is very annoying and is frequently the stumbling block our users encounter the most when developing there apps using gitpod.

My suggested implementation is that each port is exposed via two routes. <port>-<domain> as it is currently, and ports-<domain>/<port>/ with the latter having the ability to be changed by the user in config. The prefix is unimportant so long as it is static so its still hosted on the same domain.

@akosyakov
Copy link
Member

akosyakov commented Jun 5, 2023

My suggested implementation is that each port is exposed via two routes. - as it is currently, and ports-// with the latter having the ability to be changed by the user in config. The prefix is unimportant so long as it is static so its still hosted on the same domain.

But it is opposite of the representative in production, no? There are important properties of having different origin like separation of shared state, i.e. cookies, localhost, caches, and so on additionally apps are not necessary respect relative paths. If your application has to deploy everything under subpaths in production why don't you expose it on single <port> in the dev time as well? It seems to be particular issue with devsetup of concrete application.

Also it should be a separated issue.

@ChevronTango
Copy link

So the goal is the same, but let's take a step back and consider what would happen if developing on a local device. All your services would be hosted on localhost and you wouldn't have to worry about cors. So it's not representative of a dev who's testing on their local machine. When you move to prod, yes you may have to configure nginx or something else but with all the options for deployments these days there's no guarantee that AWS or other cloud providers wouldn't do that routing for you. Most devs can happily deploy without ever needing to touch ngninx config, or similar.

Disregarding that argument for a second, configuring a proxy like nginx is a pain, and gitpod is already doing the same work with its port proxy, just with less options for the users to configure. I think it's reasonable to ask gitpod to expose a couple extra options to eliminate a sizeable amount of dev that many users are repeatedly having to do in their projects. This is absolutely a convenience request to save devs time and mental strain and get them working with projects quicker and easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants