V
V
Vic Shostak2016-11-08 10:56:00
open server
Vic Shostak, 2016-11-08 10:56:00

How to configure OpenServer 5.2.5 to use secure_url() in Laravel 5.3 on localhost?

Good time!
Tell me how to solve the problem that appeared after solving my previous question? Namely, by writing everywhere in the templates {{ secure_url() }}instead {{ url() }}(and on the pictures too, because there were warnings in the chrome console about loading on the mixed content page), everything began to work on the hosting as intended.
But now on the LAN ( php artisan serve) it constantly writes Invalid request (Unsupported SSL request)to any image that is loaded via secure_url().
The localhost is OpenServer 5.2.5 x64 (Nginx 1.10, PHP 7.0), Win10x64.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander, 2016-11-08
@vikkyshostak

Write your own wrapper over the function for getting a link, which will depend on the environment settings, something like:

function get_url() {
  return (env('URL_TYPE') == 'secure') ? secure_url() : url();
}

E
Eugene Wolf, 2016-11-08
@Wolfnsex

When you run php artisan serveit, it starts the PHP built-in server, which (as mentioned above) does not support HTTP S. I think you should either run the project within the OpenServer itself, which supports both protocols at once (both HTTP and HTTP S ), or you can try using Homestand (ready and configured for Linux OS development, supplied by the Laravel developers themselves, together with Nginx, MariaDB, PostgreSQL and other goodies). Developing in a "native" environment will allow you not only to get rid of the problems described above, but also from a host of others, such as case errors in file names (which most *nix file systems are sensitive to, unlike FAT / NTFS on Windows) .
PS To install/run Homestand , you don't need to reinstall your current OS, it works great on both Linux and Windows, just install VMWare or VirtualBox.

Z
Zlatoslav Desyatnikov, 2016-11-08
@pxz

Here is the answer to your question. The webserver built into php cannot use https.
stackoverflow.com/questions/26813316/laravel-php-a... I
also don't understand what nginx has to do with it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question