Перейти к содержимому
Odoo Меню
  • Войти
  • Попробовать бесплатно
  • Модули
    Финансы
    • Бухгалтерия
    • Выставление счетов
    • Расходы
    • Таблицы
    • Документооборот
    • Подпись
    Продажи
    • CRM
    • Продажи
    • POS Магазин
    • POS Ресторан
    • Подписки
    • Аренда
    Вебсайты
    • Конструктор вебсайтов
    • eCommerce
    • Блог
    • Форум
    • Онлайн-чат
    • Электронное обучение
    Логистика
    • Склад
    • Производство
    • PLM
    • Закупки
    • Обслуживание
    • Качество
    Отдел кадров
    • Сотрудники
    • Подбор персонала
    • Отпуска
    • Оценка персонала
    • Реферальная программа
    • Автопарк
    Маркетинг
    • SMM
    • E-mail рассылки
    • СМС рассылки
    • Мероприятия
    • Автоматизация маркетинга
    • Опросы
    Услуги
    • Проекты
    • Табели
    • Выездной сервис
    • Поддержка
    • Планирование
    • Встречи
    Продуктивность
    • Обсуждения
    • Согласование
    • IoT
    • VoIP-телефония
    • Knowledge
    • WhatsApp
    Сторонние приложения Модуль Студия Odoo Платформа Odoo Cloud
  • Индустрии
    Розничная торговля
    • Книжный магазин
    • Магазин одежды
    • Мебельный магазин
    • Продуктовый магазин
    • Строительный магазин
    • Магазин игрушек
    Гостинично-ресторанный бизнес
    • Бар и паб
    • Ресторан
    • Фастфуд
    • Гостевой дом
    • Дистрибьютор напитков
    • Отель
    Недвижимость
    • Агентство недвижимости
    • Архитектурное бюро
    • Строительство
    • Управление недвижимостью
    • Ландшафтный дизайн
    • Товарищество собственников жилья
    Консалтинг
    • Бухгалтерская фирма
    • Партнер Odoo
    • Маркетинговое агентство
    • Юридическая фирма
    • Подбор персонала
    • Аудиторское бюро
    Производство
    • Текстиль
    • Металл
    • Мебель
    • Продукты питания
    • Пивоварня
    • Корпоративные сувениры
    Здоровье и фитнес
    • Спортивный комплекс
    • Магазин оптики
    • Фитнес-клуб
    • Велнес-центр
    • Аптека
    • Салон красоты
    Услуги
    • Специалист по бытовым услугам
    • Продажа и обслуживание IT-оборудования
    • Солнечные энергосистемы
    • Производство обуви
    • Клининг
    • Системы ОВКВ
    Прочее
    • Некоммерческая организация
    • Консалтинг в сфере устойчивого развития
    • Аренда рекламных щитов
    • Бизнес по фотосъемке
    • Прокат велосипедов
    • Реселлер программного обеспечения
    Все индустрии
  • Community
    Обучение
    • Видео уроки
    • Документация
    • Сертификация
    • Тренинг
    • Блог
    • Подкаст
    Образование и развитие
    • Образовательная программа
    • Деловая игра Scale Up!
    • Экскурсия в офис Odoo
    ПО
    • Скачать
    • Сравнить версии
    • Релизы
    Сотрудничество
    • Github
    • Форум
    • Мероприятия
    • Перевод
    • Стать партнером
    • Услуги для партнеров
    • Зарегистрировать бухгалтерскую фирму
    Услуги
    • Найти партнера
    • Найти бухгалтера
    • Встреча с экспертом
    • Услуги по внедрению
    • Отзывы клиентов
    • Поддержка
    • Обновления
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Заказать демонстрацию
  • Цены
  • Поддержка

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Бухгалтерия
  • Склад
  • PoS
  • Проекты
  • MRP
All apps
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Все посты Люди Значки
Теги (Смотреть все)
odoo accounting v14 pos v15
Об этом форуме
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Все посты Люди Значки
Теги (Смотреть все)
odoo accounting v14 pos v15
Об этом форуме
Помощь

reverse proxy to subdirectory <host.domain.tld>/external/erp

Подписаться

Получайте уведомления о появлении активности в этом посте

Этот вопрос был отмечен
proxyapache2subdirectoryreverse
5 Ответы
57076 Представления
Аватар
Stefan Reichel

Hi,

I am currently building and customizing a v7 instance for a client. Their server hosts various applications, e.g. mail, webdav and OpenERP. The reverse proxy (Apache2) is working in general. When we enter https:/<url.domain.tld>/external/erp hit the OpenERP server at localhost:8069 which responds with 301 but redirects to the wrong address https:/<url.domain.tld>/?db=liveDB

I have set proxy_mode = True in openerp-server.conf How can I get OpenERP to honour the invoked sub-directory "/external/erp" and redirect to https:/<url.domain.tld>/external/erp/?db=liveDB Invoking https:/<url.domain.tld>/external/erp/?db=liveDB leave the browser (Firefox) blank. The page source shows the header by the body is empty <body></body> Firebug in Firefox showed that the JS function cannot be found which led to me spotting fixed references in the html-head to href="/web/..." which should be href="web/..." (no leading slash).

The environment is OpenERP 7, Ubuntu 10.04, Apache2

Cheers, Stefan

2
Аватар
Отменить
Stefan Reichel
Автор

I assume that /web contains the static files so I used the static_http_url_prefix=/external/erp, static_http_enable = True and static_http_document_root = /usr/lib/pymodules/python2.6/openerp/addons/web but this did not seem to make any difference for the JS and CSS in the HTML head.

Аватар
Med Said BARA
Лучший ответ

Hi; Try to use NGINX.

try a google search for openerp 7 + nginx + apache

HERE:

If you need to proxy requests for a specific location to a specific resource, use a rewrite rule to capture the path to the resource and pass that along to the proxied server. For example, if you want all requests for http://example.com/ to be handed to a server running on 192.168.3.105 with a path of /teams/~example/, you would write the following location block:

File excerpt:/etc/nginx/sites-available/example.com

 location / {
   rewrite ^(.*)$ /teams/~example/$1 break;
   proxy_pass   http://192.168.3.105;
 }
0
Аватар
Отменить
Stefan Reichel
Автор

Hi, I have found loads of instructions which apply to either v6.1 or to v7 but are to redirect from http to https and to avoid port 8069. But a subdirectory seems to be the rare odd one out. from my understanding nginx is more lightweight than apache but does not actually add any functionality, right? So what ever is possible to achieve in nginx should be possible to achieve with apache and vice versa.? Please correct me if I'm wrong. Cheers

Med Said BARA

Please, take a look at : http://www.wikivs.com/wiki/apache_vs_nginx http://blog.f3re.com/comparatif-nginx-vs-apache/ http://www.thegeekstuff.com/2013/11/nginx-vs-apache/

Med Said BARA

Why NGINX? http://nginx.com/

Med Said BARA

APACHE or NGINX OR https://www.digitalocean.com/community/articles/how-to-configure-nginx-as-a-front-end-proxy-for-apache

Stefan Reichel
Автор

understood and convinced. I'll get nginx underway. I have to get myself into the config syntax and get back about any success (or failure). Thanks so far.

Med Said BARA

The hardest is the config file (nginx.conf ). Good luck ..... waiting for a feedback

Med Said BARA

The hardest is the config file (/etc/nginx/nginx.conf). Good luck, waiting for feedback

Stefan Reichel
Автор

I have put nginx before apache and OpenERP's python. It does not work great and is a lot more administration than with apache2. Due to given circumstances we cannot just redirect /(.*) as suggested as we have other hosted applications too. So my question remained unanswered to a certain degree as I don't think that the "proxy" and the "static_http" parameters in the OpenERP config actually do work. In nginx I also had to redirect /web as this is another source that's referred to in the HTML code. Cheers, Stefan

Med Said BARA

Did you read my last answer ?

Stefan Reichel
Автор

yes, I did read your answer along with the link you provided. That was all very enlightening. I need to give this another shot. I had to revert back to apache as other bits broke during the transition to nginx. I managed to get Apache to rewrite the html responses using 'ProxyHTMLUrlMap' That does exactly what I was after (rewriting the src=.. and href=.. prepending "/intern/erp"). I assume that's exactly what your last comment is meant to achieve. The HTML and JS code is right, but the UI still doesn't load but leaves and empty/white page. When I reverse-proxy /web it works though.

Med Said BARA

Follow this ---> Proxying Content with mod_rewrite http://httpd.apache.org/docs/2.2/rewrite/proxy.html

Аватар
Stefan Reichel
Автор Лучший ответ

I assume that the files served from /web/ are the static ones. Hence, I tried using the static_http_url_prefix=/external/erp, static_http_enable = True, and static_http_document_root = /usr/lib/pymodules/python2.6/openerp/addons/web This change did not have any impact.

Then I tried Apache2's RedirectMatch and RewriteRule directives but for some reason they did not kick in either.

Back to square one. no change and issue persists. Does anyone have come across this before?

Cheers, Stefan

0
Аватар
Отменить
Аватар
Stefan Reichel
Автор Лучший ответ

right. I have put nginx in place to do the proxy functionality which Apache2 did so far. however, the result is the same. Even though we can serve the static files through nginx in a static context but the assumption that any thing prefixed with "/web/" is satic failed us as /web/webclient seems to be a dynamic context i.e. cannot be found as file.

The question remains: We cannot redirect ^/.* as we have this already assigned to another application. Hence we would like to prefix the virtual path with "/internal/erp". However, this seems difficult if not impossible. We hoped that "static_http_url_prefix" would solve our issue, but that was not the case. openerp-server.conf

[options]
without_demo = False
unaccent = False
db_template = template1
db_password = noneofyourbusiness
xmlrpcs = True
xmlrpcs_interface =
syslog = False
logrotate = True
xmlrpcs_port = 8071
test_report_directory = False
list_db = True
timezone = False
xmlrpc_interface =
test_file = False
smtp_password = False
secure_pkey_file = server.pkey
xmlrpc_port = 8069
workers = 0
log_level = info
xmlrpc = True
admin_passwd = noneofyourbusiness
smtp_port = 25
smtp_server = localhost
static_http_url_prefix = /extern/erp
limit_request = 8192
test_commit = False
proxy_mode = True
demo = {}
dbfilter = .*
login_message = False
import_partial =
pidfile = False
db_maxconn = 64
osv_memory_count_limit = False
reportgz = False
osv_memory_age_limit = 1.0
netrpc_port = 8070
db_port = False
db_name = False
debug_mode = False
netrpc = False
limit_time_real = 120
limit_memory_hard = 805306368
logfile = /var/log/openerp/openerp-server.log
csv_internal_sep = ,
limit_time_cpu = 60
pg_path = None
limit_memory_soft = 671088640
static_http_enable = True
translate_modules = ['all']
smtp_ssl = False
server_wide_modules = None
netrpc_interface = 127.0.0.1
smtp_user = False
log_handler = ["[':INFO']"]
db_user = openerp
db_host = False
test_enable = False
max_cron_threads = 2
static_http_document_root = /usr/lib/pymodules/python2.6/openerp/addons/web
email_from = False
addons_path = /usr/lib/pymodules/python2.6/openerp/addons
secure_cert_file = server.cert

nginx configuration

server {
        listen   443 default;
        ssl     on;
        ssl_certificate /etc/ssl/certs/domain.com.crt;
        ssl_certificate_key /etc/ssl/private/domain.com.key;
        ssl_session_timeout  5m;
        ssl_protocols  SSLv2 SSLv3 TLSv1;
        ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
        ssl_prefer_server_ciphers   on;
        server_name  host.domain.tld;

        access_log  /var/log/nginx/webmail.domain.com.ssl_access.log;

        location ^~ /inter*/wiki/(data|conf|bin|inc) {
                deny all;
        }
        location /web {
                root /usr/share/pyshared/openerp/addons;
        }

        location /intern/erp {
                rewrite ^/intern/erp/(.*) /$1 break;
                proxy_set_header X-Real-IP  $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header Host $host;
                proxy_pass hppt://127.0.0.1:8069;
        }

#       location /internal/ {
#               alias   /var/www/;
#               index  index.html index.htm index.php;
#       }

        location /internal/ {
                proxy_set_header X-Real-IP  $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header Host $host;
                proxy_pass hppt://127.0.0.1:8080;
        }

        location /intern/ {
                proxy_set_header X-Real-IP  $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header Host $host;
                proxy_pass hppt://127.0.0.1:8080;
        }

        location /internal/erp {
                proxy_set_header X-Real-IP  $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header Host $host;
                proxy_pass hppt://127.0.0.1:8069;
        }

        location /extern/erp {
                proxy_set_header X-Real-IP  $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header Host $host;
                proxy_pass hppt://127.0.0.1:8069;
        }
        location /external/erp {
                proxy_set_header X-Real-IP  $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header Host $host;
                proxy_pass hppt://127.0.0.1:8069;
        }

        location /extern {
                proxy_set_header X-Real-IP  $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header Host $host;
                proxy_pass hppt://127.0.0.1:8080;
        }

        location ~ /\.ht {
                deny all;
        }

        # redirect to webmail/Zimbra
        location / {
                proxy_set_header X-Real-IP  $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header Host $host;
                proxy_pass hppt://127.0.0.1:81;
        }
        location /zimbra/ {
                proxy_set_header X-Real-IP  $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header Host $host;
                proxy_pass hppt://127.0.0.1:81;
        }
        location /service/ {
                proxy_set_header X-Real-IP  $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header Host $host;
                proxy_pass hppt://127.0.0.1:81;
        }
0
Аватар
Отменить
Stefan Reichel
Автор

thread help.openerp.com/question/6574/how-to-serve-http-static-files/ raises the same question but has not answer.

Med Said BARA

In case you are running two instances of openerp Just config one of your openerp (externel or internal) to run on an other port than 8069 (8169; 8869 ........) any other port not in use. And make change in nginx.conf to the port chosen.

Med Said BARA

In case you want to redirect a customer to a specific database, just append "/?db=databasename" to the URL.

Stefan Reichel
Автор

we have only one instance running on 8069. and both URLs i.e. internal and external currently respond to request but are being forwarded to the very same instance. That's okay.

Stefan Reichel
Автор

When we invoke https://fqdn/internal/erp the proxy works great and forwards the request to OpenERP. OpenERP sends a response back which redirects to the starndard DB at the absolute URL "/?db=DefaultDB" rather than the invoked relative path "/internal/erp/?db=DefaultDB".

Stefan Reichel
Автор

appending the DB to the invoked path "/internal/erp/?db=DefaultDB" returns a white page page with the HTML title "OpenERP"

Stefan Reichel
Автор

<html style="height: 100%"> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>OpenERP</title> <link rel="shortcut icon" href="/web/static/src/img/favicon.ico" type="image/x-icon"/> <link rel="stylesheet" href="/web/static/src/css/full.css" /> <link rel="stylesheet" href="/web/webclient/css?db=dreipuls"> <script type="text/javascript" src="/web/webclient/js?db=dreipuls"></script> ...

Stefan Reichel
Автор

that returned code indicates that the proxy works okay but the internal links in href=".." are wrong. Getting those changed to either be relative or have a static context prepended would solve the issue. But currently I have no idea how to get this accomplished. Any clues?

Med Said BARA

By ../external/erp , i think you mean access from the outside (external to lacal network ?). If so, have you checked the config of your router ?

Stefan Reichel
Автор

forget about the /external/erp URL. The router is fine. Let's focus on /internal/erp first. I can get the rest to work. Cheers.

Med Said BARA

If you need to proxy requests for a specific location to a specific resource, use a rewrite rule to capture the path to the resource and pass that along to the proxied server. For example, if you want all requests for http://example.com/ to be handed to a server running on 192.168.3.105 with a path of /teams/~example/, you would write the following location block:

File excerpt:/etc/nginx/sites-available/example.com

 location / {
   rewrite ^(.*)$ /teams/~example/$1 break;
   proxy_pass   <a href="http://192.168.3.105">http://192.168.3.105</a>;
 }
Med Said BARA

The link is here: https://library.linode.com/web-servers/nginx/configuration/front-end-proxy-and-software-load-balancing

Аватар
istr
Лучший ответ

This is a "known issue" since 5.1 marked as "won't fix": https://bugs.launchpad.net/openobject-client-web/+bug/384798 (sorry, need some obscure "karma" to post a direct link, so you have to copy+paste). The use case is common (SSL proxy and EV certificate or single domain policy), so using a subdomain ist not a solution. I cannot understand why nobody addresses this. C'mon, this is a bug. And it is over five years old.

 

0
Аватар
Отменить
Аватар
Valentin Lab
Лучший ответ

Hum you might want to really try Virtual Hosting instead of using subdir. Here's why:

Somehow, all links produced by the application (openerp) should be relative (and it's not the case). When I speak of "all links", I mean the CSS links, the first Javascript source links, then all the RPC calls done also. And maybe more hiding here or there. So patching openerp is a long solution. Other solution are not really complete also: they involve rewriting URL in HTTP packets content on the fly. This can be done by your Proxy, but it doesn't work all the time (they must look in CSS also, and what if you build your request in javascript ?) ...

Additionaly, there are issues in Werkzeug itself preventing this to work as-is also. If you want more info: please refer to:

https://github.com/mitsuhiko/werkzeug/issues/540

Note that there's a quick fix for the werkzeug part.

So finaly, this is a no-go. Find a way to make a VirtualHost (aka http://odoo.example.com), and avoid subdir proxying (http://example.com/odoo) unless your app is very simple and won't evolve to much. So this is not for Odoo/OpenERP.

0
Аватар
Отменить
Не оставайтесь в стороне – присоединяйтесь к обсуждению!

Создайте аккаунт сегодня, чтобы получить доступ к эксклюзивным функциям и стать частью нашего замечательного сообщества!

Регистрация
Похожие посты Ответы Просмотры Активность
[8.0]Website Module Bad redirection behind apache proxy : slash missing Решено
proxy apache2
Аватар
1
мар. 15
5795
Error in redirecting a module to the website
proxy apache2 odoo16
Аватар
1
авг. 24
1827
Apache X-Odoo-dbfilter not working Odoo 12
proxy apache2 v12
Аватар
Аватар
Аватар
Аватар
4
июл. 20
5206
Multiple OpenERP instance with port redirection Решено
proxy hosting apache2
Аватар
1
мар. 15
6738
Odoo 10 Can't restore Database with Database Manager behind Apache Proxy.
proxy apache2 databasebackup odoo10
Аватар
Аватар
Аватар
3
июл. 21
9217
Сообщество
  • Видео уроки
  • Документация
  • Форум
Открытый исходный код
  • Скачать
  • Github
  • Runbot
  • Перевод
Услуги
  • Хостинг Odoo.sh
  • Поддержка
  • Обновление
  • Индивидуальные решения по доработке
  • Образование
  • Найти бухгалтера
  • Найти партнера
  • Стать партнером
О нас
  • Наша компания
  • Активы бренда
  • Cвяжитесь с нами
  • Вакансии
  • Мероприятия
  • Подкаст
  • Блог
  • Клиенты
  • Правовые документы • Конфиденциальность
  • Безопасность
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo – это набор бизнес-модулей с открытым исходным кодом, который закроет все потребности вашей компании: CRM, E-commerce, Бухгалтерия, Склад, POS, управление проектами и др.

Odoo сочетает в себе простоту использования и полную интеграцию всех бизнес-процессов в одной системе.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now