OSX unexpectedly forwarding localhost requests to a domain - laravel

I'm scratching my head at this:
I've got a fresh laravel app which I'm developing using php artisan serve on 127.0.0.1:8000. The OS is OSX Big Sur. (important for later: docker is not running on my machine.)
There are relative image paths being used in the app, the images do exist in file system.
Some (not all) images are 404ing, because the app is trying to retrieve them from a domain I used to develop on a docker container - this was a separate app and last used months ago.
E.G. a hardcoded relative image path /media/image.jpeg will show in the network log as 404 with the URL being: https://www.example.com/media/image.jpeg Not http://127.0.0.1:8000/media/image.jpeg which would be the expected behaviour.
This happens in both Chrome and Safari, leading me to think it is not
a caching issue, though I have cleared caches in both browsers.
There is no mention of https://www.example.co.uk in /etc/hosts
There is no mention of https://www.example.co.uk in .htaccess
There is no forced SSL in the application. Apache is not being used
to serve the app, but Apache was used in the docker container
which ran https://www.example.co.uk.
Same behaviour when serving app on php artisan serve --host=derp.com in stead of 127.0.0.1
Thanks in advance for any insight!

Damnit.
Somehow, a view file had a meta tag of: <base href="https://www.example.co.uk/" /> and was causing all relative assets to go to that domain, so this wasn't an environmental issue.

Related

laravel production in windows server

im new in laravel and i have done my first project, I have xampp,mysql and windows server 2012 (installed with composer and laravel 7). i'm running the application in server via command below
php artisan serve --host=[ip] --port=[port]
application is running fine within the network. However, it seems super slow. I'm not sure if this the correct way of deploying it into production. Do you have any recommendation/instructions where can i run/deploy apps within the resource that I have.
Speed of your laravel project depends on many parameters like hardware config (CPU,RAM,...) and also number of users and level of requests and processes. But consider that for an app in production it's better to not use php artisan serve command. It's only for development environment. I don't that how much you know about linux but I suggest you to change your stack and use linux as your production os with nginx as web server alongside php-fpm for running your app in production. But for now you should config xmapp's apache web server to run your application from project's public folder. Here is a link you can use: https://insidert.medium.com/setting-up-laravel-project-on-windows-2aa7e4f080da
good luck

Laravel Valet replacing public sites with 404 Not Found

I'm learning Laravel, and I successfully installed Valet. Did some basic development. Then moved on to other things totally unrelated. About a week later (today) I visited two sites (in Chrome and Safari Mac):
postmarkapp.com
getsatisfaction.com/activeinbox
And I get "Valet - Page Not Found".
I do not get this issue any other website I visit. And I've never seen something selectively take over a site like this. It's obviously related to my local configuration but because I'm new to Valet I have no idea where to start with this.
What is happening?
How is this possible?
How do I resolve this?
What is happening?
Your network configuration is pointing those domains to valet instead of looking them up through external name servers.
How is this possible
Laravel Valet uses dnsmasq so you don't have to worry about editing your /etc/hosts file for each dev site you create. It can step in and provide ip resolution before looking externally for an ip address.
How do I fix this
From a terminal run:
valet domain test
valet restart
My guess is you changed your domain on valet to com and the reason other sites are working is their ip addresses are already cached locally.
In your project directory, you will need the public folder.
To get this, copy the public_html and duplicate it.
Proceed to rename it to public
If it's a new project, create the .env file and run php artisan key:generate
Then valet restart and you'll be good now.

Access PhpStorm web server (Laravel) via LAN

I have a Laravel Project that I develop in PhpStorm. I use the build in PhpStorm web server for development and debugging. (localhost:8000) Now I need to be able to access that server from another device within the same network.
Google search and jetbrains.com have not been very helpful. I have tried this (https://intellij-support.jetbrains.com/hc/en-us/community/posts/207020155-phpstorm-and-http-server-localhost-only-) but it did not work.
Any help?
EDIT:
I found the problem. Since the web server is launched via artisan, it ignores my PhpStorm settings. I needed to change the launch parameter, like so:
php artisan serve --host=0.0.0.0 --port=8000

Laravel 5.4 - Change URL name

So to start explaining things, I would first like to enumerate what I'm using.
I'm using Laravel 5.4 and XAMPP.
I want to deploy my project in a localhost only. So we're starting the project's server with php artisan serve --host 192.168.254.11 --port 80 where the IP stated there is the IP of the server.
In that way, we have to type the url 192.168.254.11 to access the project. Is there any way to change that without getting an online server?
EDIT: I managed to change it with tweaking of hosts file. But for it to be possible to be accessed by the other users, they have to do the same. Is there a way to only change the hosts file of the server and still be accessible by other users at the same time?

docker: what is the similar url in docker as compared to XAMMP/MAMP

I am using docker for the codeigniter project development. Initially, when I used MAMP or XAMMP, the login page was localhost/xyz/admin/login as the server used to run on localhost (php server). But, the docker server is running on localhost:8000 and I am trying to open localhost:8000/xyz/admin/login but it shows an error that page you requested not found. Does someone know the answer to this problem? I have also tried localhost:8000/myapp_1/xyz/admin/login , localhost:8000/myapp_1/admin/login etc. but nothing seems to work.
Thanks in advance!

Resources