Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Add originAliases middleware option #1215

Closed
wants to merge 1 commit into from

Conversation

benmccann
Copy link
Member

@benmccann benmccann commented May 20, 2020

Closes #489 and somewhat solves #356

Allows you to use sapper with an API service residing in another server. This is especially useful if your API server is written in another language.

This solution also allows you to use private internal hostnames when fetching data for better latency (since the request doesn't have to hit the externally-facing load balancer). It also works if fetching data from multiple domains (though I don't imagine that's the common case it seemed better not to prevent it)

I was questioning the best API for this. An alternate API might be two options: a function which rewrites URLs to fetch and a function that decides whether to include credentials. I'm open to other ideas as well and happy to implement anything that makes sense

@stalkerg
Copy link

First, I want to say a big thank you. Second, can you provide an example? If it final version I want to start fighting for that.
I will check it soon on my project. (maybe I can finally use sapper)

@benmccann
Copy link
Member Author

@stalkerg the PR has documentation that explains how to use it. You can find me on Discord with the same username if you need some additional help

Verified

This commit was signed with the committer’s verified signature.
lars-reimann Lars Reimann
@hgl
Copy link

hgl commented Mar 23, 2021

@benmccann Any reason this PR was closed?

@benmccann
Copy link
Member Author

Sapper never had a good method of handling configuration, which made it difficult to know how to integrate this feature. However, that's been addressed in SvelteKit

@stalkerg
Copy link

I have no such issue with SvelteKit anymore...

@hgl
Copy link

hgl commented Mar 25, 2021

I'll migrate to SvelteKit as soon as it's recommended for production use.

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

Successfully merging this pull request may close these issues.

Base url for server fetch requests
3 participants