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

Add example of (and fix) static asset proxy #254

Merged
merged 4 commits into from
Nov 29, 2022
Merged

Conversation

jplhomer
Copy link
Contributor

@jplhomer jplhomer commented Nov 29, 2022

Adds a code comment explaining why the shouldProxyAsset function exists and how to use it.

Also fixes asset proxying related to an errant /build/ at the beginning of the asset prefix (which is actually a subfolder of /public assets).

Screenshot 2022-11-29 at 12 14 17 PM

@github-actions github-actions bot had a problem deploying to preview November 29, 2022 16:49 Failure
* If you need to serve static assets from the same domain or from the root,
* update the `shouldProxyAsset: (url: string) => boolean` function below
* to return `true` when the url (pathname) matches your asset.
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the comment. Would be nice if we augmented the TS definition for the property so that this shows up when you're using shouldProxyAsset as well, so that it becomes a little piece of documentation for it.

Stretch goal, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey why the heck not, right?

Copy link
Contributor

@frehner frehner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So beautiful

@jplhomer jplhomer changed the title Add example of static asset proxy Add example of (and fix) static asset proxy Nov 29, 2022
@jplhomer jplhomer merged commit a2750a1 into main Nov 29, 2022
@jplhomer jplhomer deleted the jl-support-asset-proxy branch November 29, 2022 18:50
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