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

Disable origin check in Svelte configuration (GitPod workaround) #6

Merged
merged 4 commits into from
Aug 13, 2024

Conversation

tomwheeler
Copy link
Collaborator

This change allows the web application to access the API servers in GitPod

What was changed

This PR disables the origin check in the OMS web application's Svelte configuration.

Why?

When testing the OMS deployed in GitPod, I found that submitting an order through the web application resulted in HTTP 500 - Internal Error. My initial investigation suggested that this was caused by the web application being unable to reach the API servers. Alex Tideman investigated further, finding that each API server is deployed to a different domain in GitPod, ultimately leading Sveltekit to return a Cross-site POST form submissions are forbidden error.

Since GitPod assigns domains dynamically, it's not possible to know them in advance and therefore not possible to enumerate them in an allowList setting for Sveltekit. Therefore, I feel that disabling the cross-origin check is the best solution for allowing the application to work in GitPod (or similar environments); however, I recommend modifying or removing this section to improve security in a real-world deployment.

Checklist

  1. Closes

N/A, but relates to EDU-2472 (GitPod configuration and deployment).

  1. How was this tested:

Alex suggested the fix. I deployed the application in GitPod, reproduced the HTTP 500 error (i.e., without the fix), manually applied the fix and restarted the web application, and then successfully processed an order.

  1. Any docs updates needed?

This includes an update to the README, which I think is that should be necessary.

@tomwheeler tomwheeler marked this pull request as ready for review August 13, 2024 16:26
@tomwheeler tomwheeler merged commit ecd2832 into main Aug 13, 2024
3 checks passed
@tomwheeler tomwheeler deleted the tomwheeler-gitpod-fix branch August 13, 2024 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants