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

Laravel + React + Breeze Url Twice time Issue #2088

Open
ReactJsScc opened this issue Nov 11, 2024 · 5 comments
Open

Laravel + React + Breeze Url Twice time Issue #2088

ReactJsScc opened this issue Nov 11, 2024 · 5 comments
Labels
react Related to the react adapter

Comments

@ReactJsScc
Copy link

Version:
@inertiajs/react version: 1.0.0
Describe the problem:
After setting up a Laravel + React + Breeze application, I’ve noticed that sometimes the URL in my browser renders incorrectly, showing /public/ twice. For example:

### http://localhost/Ravi/inventory-main/public/Ravi/inventory-main/public/
This happens intermittently and is causing issues with how my application loads.

Steps to reproduce:
Set up a Laravel application with React and Breeze.
Access the app in the browser using http://localhost/{project-folder}/i
Occasionally, the URL will render incorrectly, showing /public/ twice, like in the example above.

@ReactJsScc ReactJsScc added the react Related to the react adapter label Nov 11, 2024
@kresnasatya
Copy link

Hi, how do you setup this project? I'm curious because the url you open is http://localhost/{project-folder}. Usually, Laravel project include Laravel + Breeze + Inertia + React can be accessed in http://localhost:8000. By the way, the Laravel team give a great tutorial for programmer to be more familiar with Laravel framework.

The tutorial called Laravel Bootcamp: https://bootcamp.laravel.com/inertia/installation. Feel free to visit. It covers step by step how to create and run Laravel Project using Inertia + React stack.

I hope it helps.

@ReactJsScc
Copy link
Author

While php artisan serve runs completely fine, when accessing the project through localhost via the XAMPP file directory, I am getting this issue

@RobertBoes
Copy link
Contributor

If you're accessing your app through http://localhost/{project}/public, that's an incorrect hosting setup for a Laravel app. You should never access the /public directory. Instead, you'd use a document_root set to the public folder of your app. Nothing to do with Inertia, just that you wouldn't run a Laravel app that way.

@kresnasatya
Copy link

Yes, the behaviour of XAMPP it self is not suitable to run the Laravel project because of the structure the Laravel framework itself. Laravel store the core (index.php) inside the public directory. In short, it's tricky to use XAMPP for this case. I would suggest to use Laragon: https://laragon.org to run Laravel project.

Article: https://medium.com/@omobadesanya/installing-and-getting-laravel-working-on-windows-in-few-steps-using-laragon-ad74da0d1e37

@benjivm
Copy link

benjivm commented Nov 11, 2024

Laragon is not maintained and has myriad issues with both PHP extensions and the latest database binaries. Just use Herd and DBngin, non-Laravel projects are trivial to serve via Valet's drivers.

A proper vhost setup will resolve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
react Related to the react adapter
Projects
None yet
Development

No branches or pull requests

4 participants