Showing posts with label reverseproxy. Show all posts
Showing posts with label reverseproxy. Show all posts

4/07/2020

Nginx Reverse configuration

Simple Nginx proxy reverse configuration


add the file proxy.conf in /etc/nginx/conf.d/


proxy_http_version 1.1;

proxy_set_header Host               $http_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 Upgrade            $http_upgrade;
proxy_set_header Connection         "Upgrade"; 



Configuration for the domain simple

server {
  listen 80;
  listen [::]:80;

  server_name example.com;

  location / { 
 include    conf.d/proxy.conf;
 proxy_pass http://192.168.123.321:3000/;
  }
}







5/07/2019

Haproxy - wordpress problem in SSL

A problem in WordPress SSL HAPROXY


Have a problem to put your SSL in your WordPress using HAPROXY as a reverse proxy?


To resolve this is simple

Add in  wp-config.php

define('FORCE_SSL_ADMIN', true);
define('FORCE_SSL_LOGIN', true);
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
  $_SERVER['HTTPS']='on';


Add this in your haproxy.


frontend webfront
  mode http
  bind 0.0.0.0:443 ssl crt /etc/haproxy/certs.d
  reqadd X-Forwarded-Proto:\ https
  ...
  ...





Make sure to use option http-server-close as well or the reqadd setting might not work as expected.