remix icon indicating copy to clipboard operation
remix copied to clipboard

Feature/basename r2

Open yracnet opened this issue 2 years ago • 1 comments

I have implemented the feature described on the https://github.com/remix-run/remix/discussions/2891.

This include the serverBasename attribute on remix.config.js for declare a prefix to URL

serverBasename default value is "" fix deploy on path server (basename) fix the navegation in client side or server side components

clean branch from from https://github.com/remix-run/remix/pull/4459

yracnet avatar Jan 24 '23 17:01 yracnet

⚠️ No Changeset found

Latest commit: dd985cf41644e2f1c62d743f43978fee574c1e05

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Jan 24 '23 17:01 changeset-bot[bot]

Thanks a lot! This would definitely be a good feature to have.

Could we get an integration test for this please?

kentcdodds avatar Jan 29 '23 14:01 kentcdodds

Something I've struggled with Remix apps hosted under the same domain at my company is redirecting from loaders and actions to other apps. For example, say we have the following apps:

App 1: domain.com/app1 App 2: domain.com/app2 ... etc. Launchpad: domain.com/home

Now say that in App 2 I return a response that should redirect to /home. What happens currently is that remix tries to find the /home route within the App2 remix router manifest, does not find it, then renders a 404.

This makes it difficult to do something like redirecting to a login page that lives in the "Launchpad" app. This PR should also handle this case if it doesn't. I know that the redirect logic within remix does handle external (non-remix) routes, but only if the domain is different. Now I want remix to check the domain + this serverBasepath.

I'm unsure if this logic lives in Remix or React Router right now, but I'm assuming Remix, since it's dependent on the X-remix-redirect header.

justinwaite avatar Jan 29 '23 15:01 justinwaite

I think I've discovered that the redirect issue will need to be resolved in react-router. I'll try and put together a PR over there.

justinwaite avatar Jan 29 '23 19:01 justinwaite

@justinwaite @kentcdodds @yracnet folks, any chance we can solve this any time soon? Any support needed with anything?

@justinwaite have you put together a PR you talked about or not just yet?

maxprilutskiy avatar Feb 19 '23 22:02 maxprilutskiy

@justinwaite @kentcdodds @yracnet folks, any chance we can solve this any time soon? Any support needed with anything?

@justinwaite have you put together a PR you talked about or not just yet?

The redirect and Link changes should be tied to this bug: https://github.com/remix-run/react-router/issues/10052

Looks like these will be taken care of soon. Then Remix needs to be updated to allow a base name.

justinwaite avatar Feb 23 '23 16:02 justinwaite

I want to know what happened to this pr.

19Qingfeng avatar Mar 23 '23 08:03 19Qingfeng

What's the status with this PR? When can we expect this to land? We're about to implement something similar in our remix app suite using https://github.com/kiliman/remix-mount-routes but if this feature is about to land in remix itself then that would be my preferred option.

dmbarry86 avatar Mar 28 '23 11:03 dmbarry86

We need this feature, too and investigated into implementing it ourself. If this PR is stale, how is the process to take over the work? At least @dmbarry86 mentioned implementing the desired functionality via third party libs, we can invest into it as well.

rolandjohann avatar Apr 05 '23 12:04 rolandjohann

Hi @yracnet!

Are you still interested in getting this one merged?

If so, please rebase onto latest dev & resolve conflicts

MichaelDeBoey avatar May 02 '23 00:05 MichaelDeBoey

This PR has been automatically closed because we haven't received a response from the original author 🙈. This automation helps keep the issue tracker clean from PRs that are unactionable. Please reach out if you have more information for us! 🙂

github-actions[bot] avatar May 12 '23 01:05 github-actions[bot]

Hi, I have implemented a plugin in ViteJS that provides support for the server's basename. You can check it out at https://www.npmjs.com/package/vite-plugin-remix

yracnet avatar Jun 01 '23 13:06 yracnet

Sad to see this PR gone, would be a helpful feature. What's the reason for not doing it the remix way, but to use vite?

maximilize avatar Nov 20 '23 23:11 maximilize

The Vite plugin seems to be using Remix internals to hack around this. I would've love to see Remix support for this because it uses React Router under the hood, which supports the basename prop, so I'm a little skeptical that the base path problem can be solved cleanly outside of Remix.

EDIT: Here I'm referring to vite-plugin-remix mentioned in https://github.com/remix-run/remix/pull/5236#issuecomment-1572071545.

Vite itself has a base option, but it only refers to assets. Perhaps now that Remix is moving to Vite that option can be used in the Remix Vite plugin somehow and used accordingly.

silvenon avatar Nov 21 '23 10:11 silvenon

The Vite plugin seems to be using Remix internals to hack around this. I would've love to see Remix support for this because it uses React Router under the hood, which supports the basename prop, so I'm a little skeptical that the base path problem can be solved cleanly outside of Remix.

Vite itself has a base option, but it only refers to assets. Perhaps now that Remix is moving to Vite that option can be used in the Remix Vite plugin somehow and used accordingly.

This is what I would like to see as well, but perhaps we need to wait for vite support to stabilize more. I know that some changes are occurring with the asset paths per #8077

justinwaite avatar Nov 21 '23 20:11 justinwaite

Is anyone still interested in getting this PR merged?

0xahmedk avatar Jan 03 '24 10:01 0xahmedk