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

[Feature]: Configuring whether path prefix is stripped for services w/o a gateway #2250

Closed
jvstme opened this issue Jan 31, 2025 · 0 comments · Fixed by #2254
Closed

[Feature]: Configuring whether path prefix is stripped for services w/o a gateway #2250

jvstme opened this issue Jan 31, 2025 · 0 comments · Fixed by #2254
Assignees
Labels

Comments

@jvstme
Copy link
Collaborator

jvstme commented Jan 31, 2025

Problem

Currently, when a service is run without a gateway, dstack strips the /proxy/services/<project>/<run> path prefix before forwarding the request upstream. So /proxy/services/<project>/<run>/ becomes /, /proxy/services/<project>/<run>/a/b/c becomes /a/b/c, etc.

This allows API-only services to work out of the box. This also works for web apps that allow configuring the root path but don't expect to receive it in requests, e.g. ASGI apps served with uvicorn.

However, many popular web apps do expect to receive the path prefix in requests if it is configured as their root path. Such apps don't currently work without a gateway.

Solution

Add a boolean service configuration option to control whether the path prefix is stripped, e.g. strip_prefix. The default is strip_prefix: true (current behavior). The option is ignored when running with a gateway.

Would you like to help us implement this feature by sending a PR?

Yes

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

Successfully merging a pull request may close this issue.

1 participant