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

Ability to Disable URL Rewrite #2556

Open
Shackelford-Arden opened this issue Mar 22, 2024 · 1 comment
Open

Ability to Disable URL Rewrite #2556

Shackelford-Arden opened this issue Mar 22, 2024 · 1 comment

Comments

@Shackelford-Arden
Copy link

Current Situation

In lower/dev environments, hosting Stoplight Elements behind something like a software load balancer/proxy (Traefik/Fabio/Nginx, etc) can sometimes mean that they are accessed via a subfolder-like path.

Example URL: https://lb.internal.fqdn/fancy-app/docs

In the example above, the load balancers can be configured to strip the /fancy-app piece of the request when forwarding the request on to my application.

Today I can get this to work by ensuring the basePath is aware of the /fancy-app URI to properly load the OpenAPI spec provided. I can get the UI to load once by having router="history". However, the moment the page loads, the URL gets re-written to remove the /fancy-app component of the URL.

Once https://lb.internal.fqdn/fancy-app/docs loads, it immediately shows https://lb.internal.fqdn/docs. Using any of the other routers simply fails to load the docs entirely.

My question

Is there a way to configure Stoplight to not rewrite the URL in this scenario? I assume there is something specific to React (or whichever framework Stoplight uses) where this would be configured, if it is even possible.

References

Current Config

<!doctype html>
<html lang="en">
<head>
	<meta charset="utf-8" />
	<meta name="referrer" content="same-origin" />
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	<title>Fancy App API Documentation</title>
	<script src="https://unpkg.com/@stoplight/elements/web-components.min.js"></script>
	<link rel="stylesheet" href="https://unpkg.com/@stoplight/elements/styles.min.css" />
</head>
<body style="height: 100vh;">
	<elements-api
		basePath="/fancy-app"
		apiDescriptionUrl="/api/openapi.json"
		layout="responsive"
		router="history"
		tryItCredentialsPolicy="same-origin"
	/>
</body>
</html>
Copy link

github-actions bot commented Apr 2, 2024

This ticket has been labeled jira. A tracking ticket in Stoplight's Jira (STOP-425) has been created.

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

3 participants