Local url [app_url] not working in Laravel Breeze Vue - laravel

So I tried creating a new project using Breeze+vue in Laravel.
I was following this guide: https://www.youtube.com/watch?v=A7UlfXPhsaA
When I finally got vite running on npm run dev without issues, I came across the app_url and I tried to change it to something similar like in that guide (timestamp 6:14 in video), in my case the app_url value was just http://localhost and I changed it to http://grandia.test.
And it reflects like that when vite is running:
VITE v3.1.0 ready in 1031 ms
➜ Local: http://localhost:5173/
➜ Network: use --host to expose
LARAVEL v9.28.0 plugin v0.6.0
➜ APP_URL: http://grandia.test
but nothing happens when I go to the site. only the localhost:5173 works properly.
I tried googling for answers but I couldn't find anything helpful.
Could someone help me out what I'm doing wrong or missing? Thanks!

I had the same issue, It look like you changed URL: http://grandia.test instead of localhost. So you should try with npm run build instead.

Changing Laravel’s APP_URL parameter will not magically allow you to choose the URL your website is served at. It will only tell Laravel what it should use when generating URLs related to your website.
The video’s author uses the Laravel Valet local development environment. It provides a park command that allows you to automatically serve the subfolders of some folder (e.g. Sites in the video) at http://<subfolder>.test.
In the video, the project is created in Sites/reddit-clone/, which makes it possible to directly access it at reddit-clone.test.

Related

Replace localhost with my domain in Laravel when in production

I am using SPA (Laravel and Vuejs). When in development, website project worked perfect but when after running npm run production and put it on live server, I got errors saying
Access to Xmlhttprequest at http://localhost:8000/auth_check from origin https://hamariweb.com/auth_check has been blocked by Cors policy.
I have tried different solutions that fixed their problems but not mine. I want to know what is wrong with it and how can I fix it?
Sounds like somewhere in your code you're trying to send a request to http://localhost:8000/auth_check which isn't going to work in prod. You need to find the call to that URL and replace it with a call to the correct URL.
You can create an ENV setting in your .env file like this.
APP_URL=https://hamariweb.com
Then share that env file to your javascript code like this.
MIX_APP_URL="${APP_URL}"
Any ENV settings that start with MIX_ are passed to Javascript and this is passing it the initial APP URL value.
To finally grab the app url in the JS do this:
process.env.MIX_APP_URL
You can even assign the entire env settings globally like this.
if(process && process.env){
window.env = process.env;
}
Any .env MIX_ variables will be available in window.env at that point and in your SPA you'll be able to make the URL or any other variable configurable based on environment.

Postman not Working with Laravel Valet (Local)

When I use Postman to send or get data to/from my local Laravel applications it always returns the error...
Could not get any response.
For example, a GET request to
http://demo_app.localhost/api/data.
I use Laravel Valet on my Mac. It looks like Postman can't find the local domain.
I had the same issue when trying to use valet with Postman and what fixed it for me was turning off the SSL verification in Settings > General. I believe valet is using some internal SSL certificate by default that cannot be verified properly by Postman.
Use TLD .test, if your Valet version is up-to-date and not specifically configured to use .localhost.
Should be like http://demo_app.test/api/data
See official docs for background:
Valet documentation at chapter "Using Another Domain".
I had the same issue and used all the suggestion above, none of them works.
For my case, I used the following command to fix the problem:
php artisan optimize
This clears the cache and config files and reloads the new api Routes added to the Laravel framework.

Laravel logs in Heroku not showing up

I've deployed a Laravel app to heroku by following the official guide. It says to change APP_LOG=errorlog, which I've done.
I've also tried two different versions of this, the commented line being the variation.
$this->app->configureMonologUsing(function($monolog){
// $monolog->pushHandler(new \Monolog\Handler\SyslogHandler('papertrail'));
$monolog->pushHandler(new \Monolog\Handler\StreamHandler('php://stderr', \Monolog\Logger::WARNING));
});
If I use Log::error('something') I'm not seeing anything. I'm looking in both papertrail, and the CLI command heroku logs --tail --app {appname}
You must set LOG_CHANNEL=errorlog as a Heroku environment variable.
This setting is for Laravel 5.6, in older versions it was other. (and that "old" information is found on most internet sites, when searching for the problem)
This information can be found in .env file, which values must be manually set in Heroku.
Why?
The .env is not transferred to heroku, because it is listed in .gitignore.
BTW: I had the same issue today, seems like the setting you tried was valid for an older version of Laravel. I now use 5.6.

Remotely access Parse dashboard

I managed to configure stand alone Parse server for my Android app using ubuntu server and mongoDB. And now Parse released its open source dashboard for parse server which I am able to setup but getting error in accessing it remotely.
As it says "Parse Dashboard can only be remotely accessed via HTTPS". I have almost no experience of developing web app. I have tried changing http to https in url but it didn't worked!
I have also tried adding username and password for basic auth, but it didn't worked either! Here's link for parse dashboard
https://github.com/ParsePlatform/parse-dashboard
Try starting the dashboard like this:
export PARSE_DASHBOARD_ALLOW_INSECURE_HTTP=1
npm run dashboard
I have the same problem. I set up the parse server through heroku. I tried antsyawn's suggestion, it did not work. The github to parse-dashboard just updated a little more.
Now you should:
npm install -g parse-dashboard
parse-dashboard --appId yourAppId --masterKey yourMasterKey --serverURL "https://example.com/parse" --appName optionalName
They did suggested to add --allowInsecureHTTP=1
Nevertheless, I tried all that as well and its not working. May be you can try this too since you set up your server differently(it might work).
im working with ParseServer And ParseDashboard to Start we cant create confused about two.
For me , more important is ParseDashboard, And yes you can acess Remotely, firstly you need create a hack direct in code to do that.
To run parse dashboard without problems follow this steps.
git clone git#github.com:ParsePlatform/parse-dashboard.git
cd parse-dashboard
npm install
After this! after!...
npm run dashboard
This screen will be showed to you...
When this image is running you can acess by url your serverIp:4040 will show dashboard.
dashboard is running.
The answer from #xiaowoo worked for me. For a visual, I watched this video
Install Parse Server and Parse Dashboard to Digital Ocean
In summary, here is what I ended up running:
parse-dashboard --appId MyApp --masterKey mysupersecretmasterkey --serverURL "https://198.58.10.23/parse" --appName TestApp --allowInsecureHTTP=1
Server response:
The dashboard is now available at http://0.0.0.0:4040/
Browse to your dashboard:
http://198.58.10.23:4040

Hosting a laravel application

I'm new here. I've tried all I could but couldn't setup my laravel app. I've also tried the solutions provided here
How to install Laravel 4 to a web host subfolder without publicly exposing /app/ folder?
but I keep on getting HTTP Error 500.0 - Internal Server Error The page cannot be displayed because an internal server error has occurred.Any help please?
change your host php version
PHP >= 5.4
MCrypt PHP Extension
http://laravel.com/docs/4.2#server-requirements
Consider using Forge, it saves you a lot of time and you would support the creator

Resources