Laravel and ProxyPass/ProxyPassReverse base URL fix« Wróć do listy pytań

how to fix base url? indead of local hostname
Wysłane przez mrmucha
Zadane przez 03/09/2018 13:33
0

WARNING!: this solution is not working for /login methon od auth controller.

WORKAROUND: try to change ProxyPass url from my.service.local to my.service.com and modify /ets/hosts file of those two servers to point that my.service.com to local ip address of internal server

Wysłane przez mrmucha
Odpowiedziane 03/09/2018 14:19
0

1. edit /routes/api.php
2. add

1
2
3
4
5
6
7
8
9
10
$proxy_url    = getenv('PROXY_URL');
$proxy_schema = getenv('PROXY_SCHEMA');
 
if (!empty($proxy_url)) {
    URL::forceRootUrl($proxy_url);
}
 
if (!empty($proxy_schema)) {
    URL::forceSchema($proxy_schema);
}
$proxy_url    = getenv('PROXY_URL');
$proxy_schema = getenv('PROXY_SCHEMA');

if (!empty($proxy_url)) {
	URL::forceRootUrl($proxy_url);
}

if (!empty($proxy_schema)) {
	URL::forceSchema($proxy_schema);
}

3. edit .env file
4. put

1
2
PROXY_URL = http://internet.address.com
PROXY_SCHEMA = http
PROXY_URL = http://internet.address.com
PROXY_SCHEMA = http
Wysłane przez mrmucha
Odpowiedziane 03/09/2018 13:36