Как конвертировать заголовки X-Forwarded из Nginx в ApacheApache

Ответить Пред. темаСлед. тема
Гость
 Как конвертировать заголовки X-Forwarded из Nginx в Apache

Сообщение Гость »


Я нашел

Код: Выделить всё

proxy_set_header
for

Код: Выделить всё

reverse proxy
from this link:
Secure tileserver-gl using ssl in centOS
Here is the Nginx config:

Код: Выделить всё

location / {
proxy_pass http://localhost:80;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
}
Here is the test request log for Nginx:

Код: Выделить всё

GET /maplibre-gl.css 304 0.528 ms - -
GET /maplibre-gl-inspect.css 304 0.310 ms - -
GET /leaflet.css 304 0.249 ms - -
GET /maplibre-gl.js 304 0.223 ms - -
GET /maplibre-gl-inspect.min.js 304 1.575 ms - -
GET /leaflet.js 304 0.402 ms - -
GET /leaflet-hash.js 304 0.375 ms - -
GET /mapbox-gl-rtl-text.js 200 0.845 ms - 206897
GET /styles/basic-preview/style.json 200 2.144 ms - 14704
GET /data/v3.json 200 1.874 ms - 20363
GET /mapbox-gl-rtl-text.js 304 0.423 ms - -
Here is the Apache config:

Код: Выделить всё

ProxyPass "/" "http://localhost:80/"
ProxyPassReverse "/" "http://localhost:80/"

# I just copy here, not working in Apache

proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
Here is the test request log for Apache:

Код: Выделить всё

GET /maplibre-gl.css 200 8.506 ms - 63722
GET /maplibre-gl-inspect.css 200 8.473 ms - 1877
GET /leaflet.css 200 8.654 ms - 14145
GET /maplibre-gl-inspect.min.js 200 7.890 ms - 23362
GET /leaflet.js 200 10.616 ms - 147552
GET /leaflet-hash.js 200 5.913 ms - 3462
GET /maplibre-gl.js 200 8.035 ms - 762783
GET /mapbox-gl-rtl-text.js 200 0.822 ms - 206897
GET /styles/basic-preview/style.json 304 2.152 ms - -
GET /data/v3.json 304 1.674 ms - -
GET /mapbox-gl-rtl-text.js 200 0.698 ms - 206897
When testing

Код: Выделить всё

tileserver-gl
with and : Nginx will get "" response code, but Apache get "" response code. And Nginx is working fine with tileserver-gl but Apache does not.
I want to copy all header settings from config to config file for testing purpose but I don't know the correct syntax.
How to convert all

Код: Выделить всё

proxy_set_header
above to Apache?


Источник: https://stackoverflow.com/questions/781 ... -to-apache
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение
  • X-FORWARDED-HOST Принимаются несколько параметров?
    Anonymous » » в форуме Apache
    0 Ответы
    61 Просмотры
    Последнее сообщение Anonymous
  • Заголовок X-Forwarded-For не работает при использовании RewriteRule с Proxypass
    Гость » » в форуме Apache
    0 Ответы
    70 Просмотры
    Последнее сообщение Гость
  • Удалить заголовок X-Forwarded-Prefix из маршрута Spring Cloud Gateway
    Anonymous » » в форуме JAVA
    0 Ответы
    22 Просмотры
    Последнее сообщение Anonymous
  • Как зарегистрировать IP-адрес клиента и IP-адрес X-Forwarded-For в журнале доступа tomcat
    Anonymous » » в форуме JAVA
    0 Ответы
    14 Просмотры
    Последнее сообщение Anonymous
  • Как зарегистрировать IP-адрес клиента и IP-адрес X-Forwarded-For в журнале доступа tomcat
    Anonymous » » в форуме JAVA
    0 Ответы
    11 Просмотры
    Последнее сообщение Anonymous

Вернуться в «Apache»