Skip to content

Conversation

@rojtjo
Copy link
Contributor

@rojtjo rojtjo commented Feb 10, 2023

This pull request provides an alternative solution to @FrittenKeeZ's pull request ( #499) by allowing you to configure a callback that resolves the current URL. This way it can be easily configured to anyone's needs by overriding the urlResolver method in the HandlesInertiaRequests middleware. When this method returns null it falls back to the default behavior.

Example:

use Inertia\Middleware;

class HandleInertiaRequests extends Middleware
{
    public function urlResolver(Request $request): ?callable
    {
        return fn (Request $request) => 'https://inertiajs.com/'.$request->getRequestUri();
    }
}

@mahbubahmed
Copy link

@rojtjo This is an elegant solution to fix broken URLs when the application is inside a sub-directory.

When can we expect to get this solution merged?

innocenzi added a commit to hybridly/hybridly that referenced this pull request Apr 7, 2023
@brgmn
Copy link

brgmn commented Jun 8, 2023

Would really like to see this merged! Thanks @rojtjo for your great work! I think this could also solve running Laravel Nova 4.x in a subdirectory (based on inertia, broken at the moment).

@PrasadChinwal
Copy link

Thanks a lot for this PR @rojtjo 👍

Hey @reinink is this something you could see getting merged? There are numerous issues which could be resolved with this.
Ex. #422 and #437

@ngekoding
Copy link

Any update for this?

Will the PR merged or any other solutions?

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.

5 participants