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

Browser publicPath totally ignored in @remix-run/serve #2933

Closed
fguitton opened this issue Apr 20, 2022 · 2 comments
Closed

Browser publicPath totally ignored in @remix-run/serve #2933

fguitton opened this issue Apr 20, 2022 · 2 comments

Comments

@fguitton
Copy link

fguitton commented Apr 20, 2022

Hello,
I hope you are having a great day !
🌴

What version of Remix are you using?

1.4.1

Steps to Reproduce

Create a remix application and set the remix.config.js field publicPath to something other than /build/.
Upon running remix dev and accessing the URL in a browser, assets cannot be found.

Expected Behavior

It should be possible to customize the asset serving path while developing.

Actual Behavior

Currently the publicPath is being ignored and prevents the use of a custom path while developing.
No mention of this limitation is made in the documentation as far as I know.
Behavior is consistent with the hardcoded path in the codebase.

app.use(
"/build",
express.static("public/build", { immutable: true, maxAge: "1y" })
);
app.use(express.static("public", { maxAge: "1h" }));

@samlaycock
Copy link

I'm seeing the same problem as well, using the Cloudflare Workers runtime. Seems as though the publicPath value in the Remix config is just not being regarded in the serving of static assets of any runtime.

If the intention of this is to simply support CDN domains for static assets, and I'm not sure if it is or not, the docs really should say so... the presumption is we can use this to add route prefixes to the static URLs to allow for more complex routing scenarios (behind proxies/load balancers etc.)

let assetpath = build.assets.url.split("/").slice(0, -1).join("/");
let requestpath = url.pathname.split("/").slice(0, -1).join("/");

@machour
Copy link
Collaborator

machour commented Jan 24, 2023

This have been fixed by #3349

@machour machour closed this as completed Jan 24, 2023
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

4 participants
@machour @fguitton @samlaycock and others