Proxying to another Netlify site mostly working, but assets missing

*Update: The issue seems to be around having the trailing slash in the URL. Unfortunately, if someone visits https://lokeshdhakar-com.netlify.app/projects/color-thief they will see broken assets. If they add a trailing slash the assets will load correctly. Since it seem like trailing slash redirects are not allowed, I’m not sure if this issue has a fix for those visiting and not including the slash. :neutral_face:

Small issue, but a dealbreaker for me on this site. I’m still moving some other items over, as Netlify for single repo to single domain hosting has been amazing.*

Hello - I have two Netlify sites:

  1. https://lokeshdhakar-com.netlify.app/
  2. https://color-thief-site.netlify.app/

Both render correctly. My goal is to have the https://lokeshdhakar-com.netlify.app/projects/color-thief folder point to site #2. So my Color Thief site will show up when you visit the /projects/color-thief url.

I’ve created a _redirects file in site #1 with the following content:
/projects/color-thief/* https://color-thief-site.netlify.app:splat 200

Visiting https://lokeshdhakar-com.netlify.app/projects/color-thief/ renders site #2, so far so good, but… my built JS and CSS assets are not being found. These files are all loaded by the index.html using relative paths and live in the build folder alongside this index.html file.

I’m seeing a 500 error and the JS and CSS assets are not loading. Any ideas? Let me know if I can provide any other information to help debug. Thank you! :raised_hands:

Well, not the perfect answer probably, but, you can make the paths in https://color-thief-site.netlify.app/ absolute.

What’s happening is, without the /, the browser thinks that color-thief is just a file inside the projects directory that does not have an extension. So, all your relative URLs are now getting mapped to /projects/, for example, https://lokeshdhakar-com.netlify.app/projects/main.94c3ed36.css which obviously, does not exist.

With the / however, browser knows that it has to load index.html inside the directory color-thief and thus, all the relative links are getting mapped to color-thief directory and it all exists there.

So, I’d say, if you don’t want to use absolute URLs, don’t let the users use the one without /. Because, if you link correctly, I don’t think your users would deliberately go and change the URL in the address bar, just to see how your website would look without /.

1 Like