Disable origin check in Svelte configuration (GitPod workaround) #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
N/A, but relates to EDU-2472 (GitPod configuration and deployment).
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.
This includes an update to the README, which I think is that should be necessary.