D
D
DYLAN2020-02-06 15:32:52
Nginx
DYLAN, 2020-02-06 15:32:52

How to change REQUEST_SCHEME to https when proxying?

Actually the next problem. There is an nginx Server that accepts various requests for 3 domains over HTTPS and redirects them to 3 local ones, depending on the domain in the request.

yiWJXTA.png

respectively, on the servers for sites (site1-site3) in the super global array, there are the following values:
$_SERVER['REQUEST_SCHEME'] = 'http'
$_SERVER['SERVER_PORT'] = '80'

Accordingly, many problems arise because of this. How it is possible to force servers to replace these values?
Using PHP is not an option, because not all sites use a single entry point where you can cheat and replace these values ​​with your hands

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DYLAN, 2020-02-06
@ermolaev_nikita

It turned out, but logically it is not possible to establish an exact connection.
If you specify the server name with the scheme and port in the Apache settings (ServerName https://site1.ru:443), then the array becomes:
$_SERVER['REQUEST_SCHEME'] = 'https'
$_SERVER['SERVER_PORT'] = '443 '
However, the links on the site are built incorrectly and lead to site1.ru , however, if you enable UseCanonicalPhysicalPort On, then the links on the site are treated, but so far it is not possible to understand the logic

X
xmoonlight, 2020-02-06
@xmoonlight

Don't use nginx.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question