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

Fix: front-end not working when Laravel is installed in a subdirectory #281

Closed
wants to merge 1 commit into from

Conversation

Zerquix18
Copy link
Contributor

After my pull request #272 I found out that the routes in vue-route were also pointing at /telescope (in the root directory), so anytime I clicked on something, it just showed me a 404 error. I fixed this again after hours of experimenting, and after testing, it works when:

  • Laravel is installed in the DOCUMENT_ROOT directory
  • Laravel is installed in a subdirectory
  • Laravel is called from a subdomain

I can finally use it in peace.

image
image

Hope this is useful.

@taylorotwell
Copy link
Member

Don't run Laravel in a sub-directory.

@Zerquix18
Copy link
Contributor Author

I hope you reconsider this if more people in the future come with this problem.

@amitm13
Copy link

amitm13 commented Nov 21, 2018

@taylorotwell @themsaid But most peoples use laravel in sub directorty until they release it in product environment. i hope it will fix in next update.

@joshuand1990
Copy link

@amitm13 maybe use a view composer since its using a variable.

View::composer(['telescope::layout'], function ($view) { $view->with('telescopeScriptVariables', [ 'path' => 'subfolder/admin/telescope', 'timezone' => config('app.timezone'), 'recording' => ! cache('telescope:pause-recording'), ]); });

@grey-dev-0
Copy link

@joshuand1990 That did the trick, thank you.

@itsmekps
Copy link

itsmekps commented Jan 6, 2019

@joshuand1990 @grey-dev-0 can you please tell me in little detail, i am new to laravel.

@grey-dev-0
Copy link

grey-dev-0 commented Jan 8, 2019

@itsmekps In your AppServiceProvider class add the lines in @joshuand1990 's comment to the boot method.

@dillingham
Copy link

“Most people” use sub domains not sub directories for staging

@grey-dev-0
Copy link

@dillingham using subdomains is the right way but, it's not doable for everyone, as for some people they might not be able to access their domain settings to create a subdomain so, they do their testing in a subdirectory instead.

@dillingham
Copy link

@grey-dev-0 well it not working in sub directories is a good reason to tell your upper management :) if they setup a domain for your production they can setup a simple sub domain so you can do it, as you put it, “the right way” :)

@luisg595
Copy link

I have the same problem. I need to see telescope from a subfolder. The rules of Nginx works well for Laravel, but telescope isn't works.

@luisg595
Copy link

luisg595 commented Mar 13, 2019

@amitm13 maybe use a view composer since its using a variable.

View::composer(['telescope::layout'], function ($view) { $view->with('telescopeScriptVariables', [ 'path' => 'subfolder/admin/telescope', 'timezone' => config('app.timezone'), 'recording' => ! cache('telescope:pause-recording'), ]); });

This worked for me. Thank you!

@alessandrobelli
Copy link

View::composer(['telescope::layout'], function ($view) { $view->with('telescopeScriptVariables', [ 'path' => 'subfolder/admin/telescope', 'timezone' => config('app.timezone'), 'recording' => ! cache('telescope:pause-recording'), ]); });
Worked like a charm!

@drekinov drekinov mentioned this pull request May 29, 2019
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.

None yet

9 participants