コンテンツへスキップ
Odoo メニュー
  • サインイン
  • 無料で15日試す
  • アプリ
    財務
    • 会計
    • 請求
    • 経費
    • スプレッドシート(BI)
    • ドキュメント管理
    • 署名
    販売
    • CRM
    • 販売
    • POS店舗
    • POSレストラン
    • サブスクリプション
    • レンタル
    ウェブサイト
    • ウェブサイトビルダー
    • eコマース
    • ブログ
    • フォーラム
    • ライブチャット
    • eラーニング
    サプライチェーン
    • 在庫
    • 製造
    • 製品ライフサイクル管理 (PLM)
    • 購買
    • 整備
    • 品質
    人事業務
    • 従業員管理
    • 採用
    • 休暇管理
    • 人事評価
    • リファラル
    • フリート
    マーケティング
    • ソーシャルマーケティング
    • メールマーケティング
    • SMSマーケティング
    • イベント
    • マーケティングオートメーション
    • アンケート調査
    サービス
    • プロジェクト管理
    • タイムシート
    • フィールドサービス
    • ヘルプデスク
    • 計画
    • アポイントメント
    生産性向上ツール
    • ディスカッション
    • 承認
    • IoT
    • VoIP
    • ナレッジ
    • WhatsApp
    サードパーティアプリ Odooスタジオ Odooクラウドプラットホーム
  • インダストリー(業種別ソリューション)
    小売
    • 書店
    • アパレルショップ
    • 家具専門店
    • 食料品店
    • 金物店
    • 玩具店
    飲食・ホスピタリティ業界
    • バー・パブ
    • レストラン
    • ファストフード
    • ゲストハウス
    • 飲料販売代理店
    • ホテル
    不動産
    • 不動産会社
    • 建築事務所
    • 建設
    • 不動産管理
    • 造園
    • 住宅所有者組合
    コンサルティング
    • 会計事務所
    • Odooパートナー
    • マーケティングエージェンシー
    • 法律事務所
    • 人材派遣
    • 監査・認証
    製造
    • テキスタイル
    • 金属
    • 家具
    • 飲食
    • 醸造所
    • コーポレートギフト
    ヘルス & フィットネス
    • スポーツクラブ
    • 眼鏡店
    • フィットネスセンター
    • ウェルネス専門家
    • 薬局
    • ヘアサロン
    業種
    • 便利屋
    • IT ハードウェア・サポート
    • 太陽エネルギーシステム
    • 靴メーカー
    • クリーニングサービス
    • 空調設備サービス
    その他
    • 非営利団体
    • 環境機関
    • ビルボードレンタル
    • 写真
    • 自転車リース
    • ソフトウェアリセラー
    すべての業種を見る
  • コミュニティ
    学ぶ
    • チュートリアル
    • ドキュメンテーション
    • 認定
    • トレーニング
    • ブログ
    • ポッドキャスト
    教育サポート
    • 教育プログラム
    • 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
このフォーラムについて
ヘルプ

Odoo 18 (from source) on Ubuntu running behind nginx - Odoo logs not showing real IP address

購読

この投稿に活動があった際に通知を受け取ります

この質問にフラグが付けられました
nginxNGINX
2 返信
4801 ビュー
アバター
M S

Hi,

I have Odoo 18 (using source) running behind Nginx successfully. For some reasons, the odoo logs do not show the real IP address for users. Nginx is configured to forward the IP (X-Forwarded-For) to backend and odoo config has proxy_mode set to true. I have done some searching on the Internet already and couldn't find anything in particular that may fix this issue.

Odoo log entry:

2025-05-01 03:39:19,437 4086 INFO odoo odoo.addons.base.models.res_users: Login failed for db:odoo login:oodf from 127.0.0.1

I am providing the nginx and odoo config files below as well below.

Nginx config

# Odoo servers
geo $limit {
  default 1;
  1.2.3.4/22 0;
  1.2.3.4/24 0;
  1.2.3.4/24 0;
  1.2.3.4/24 0;
  1.2.3.4/20 0;
}

map $limit $limit_key {
        0 "";
        1 $binary_remote_addr;
}

limit_req_zone $limit_key zone=general:10m rate=200r/m;

upstream odoo {
server 127.0.0.1:8069;
}

upstream odoochat {
server 127.0.0.1:8072;
}

map $http_upgrade $connection_upgrade {
  default upgrade;
  ''      close;
}

# HTTP -> HTTPS
server {
  listen 80;
  server_name mywebsite.example.com;
  include snippets/letsencrypt.conf;
  return 301 https://mywebsite.example.com$request_uri;
}
# WWW -> NON WWW
server {
    listen 443 ssl http2;
    server_name www.mywebsite.example.com;
    ssl_certificate /etc/letsencrypt/live/mywebsite.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/mywebsite.example.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/mywebsite.example.com/chain.pem;
    include snippets/ssl.conf;
    include snippets/letsencrypt.conf;

    return 301 https://mywebsite.example.com$request_uri;
}

server {
    listen 443 ssl http2;
    server_name mywebsite.example.com;
    proxy_read_timeout 720s;
    proxy_connect_timeout 720s;
    proxy_send_timeout 720s;

    # Proxy headers
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Real-IP $remote_addr;

    # SSL parameters
    ssl_certificate /etc/letsencrypt/live/mywebsite.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/mywebsite.example.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/mywebsite.example.com/chain.pem;
    include snippets/ssl.conf;
    include snippets/letsencrypt.conf;


    # Increase client_max_body_size to your required ammount
    client_max_body_size 20M;

    # log files
    access_log /var/log/nginx/odoo.access.log;
    error_log /var/log/nginx/odoo.error.log;

    # Redirect websocket requests to odoo gevent port
    location /websocket {
    proxy_pass http://odoochat;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_set_header X-Forwarded-Host $http_host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Real-IP $remote_addr;
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
    proxy_cookie_flags session_id samesite=lax secure;
    proxy_redirect off;
  }

  # Handle longpoll requests
    location /longpolling {
        proxy_pass http://odoochat;
    }

    # Redirect requests to odoo backend server
    location / {
            # Add Headers for odoo proxy mode

            limit_req zone=general burst=50 nodelay;
            proxy_set_header X-Forwarded-Host $http_host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_redirect off;
            proxy_pass http://odoo;

            # Enable HSTS
            add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
            # requires nginx 1.19.8
            proxy_cookie_flags session_id samesite=lax secure;
    }

    # Cache static files
    location ~*/web/static/ {
        limit_req zone=general;
        proxy_set_header X-Forwarded-Host $http_host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_cache_valid 200 90m;
        proxy_buffering on;
        expires 864000;
        proxy_pass http://odoo;
        #add_header Content-Security-Policy $content_type_csp;
    }

    # Gzip
    gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
    gzip on;
} ​

Odoo Config file

[DEFAULT]
admin_passwd = abcdefghijklmn
db_host = False
db_port = False
db_user = odoo
db_password = False
addons_path = /opt/odoo/odoo/addons,/opt/odoo/odoo-custom-addons
proxy_mode = true
list_db = False ​ ​

Does anyone have any ideas as to what could the problem be?


Thanks,

Mohammad

0
アバター
破棄
アバター
M S
著作者 最善の回答

Thanks for the suggestion. 

Unfortunately, changing "true" to "True" in the odoo config made no difference. Yes, I restarted the services as mentioned. Just  to be sure, I also rebooted the server after making the changes but odoo log is still showing 127.0.0.1

[DEFAULT]
admin_passwd = xxxxxxxxxxxx
db_host = False
db_port = False
db_user = odoo
db_password = False
addons_path = /opt/odoo/odoo/addons,/opt/odoo/odoo-custom-addons
proxy_mode = True
list_db = False

2025-05-03 10:13:23,229 1536 INFO odoo werkzeug: 127.0.0.1 - - [03/May/2025 10:13:23] "POST /web/login HTTP/1.0" 200 - 6 0.010 0.008
2025-05-03 10:13:23,369 1536 INFO odoo werkzeug: 127.0.0.1 - - [03/May/2025 10:13:23] "GET /web/binary/company_logo HTTP/1.0" 304 - 2 0.001 0.002
2025-05-03 10:13:23,728 1536 INFO odoo werkzeug: 127.0.0.1 - - [03/May/2025 10:13:23] "GET /web/webclient/translations/1746267203712 HTTP/1.0" 200 - 2 0.001 0.002
0
アバター
破棄
アバター
Takahiro SUNAGA
最善の回答

Hi, 
Shouldn't "proxy_mode = true" instead of "proxy_mode = True"?
Try restarting the service after the fix.

Summary of Steps:

  1. Ensure proxy_mode = True is under the [options] section in odoo.conf.
  2. Restart the Odoo service (sudo systemctl restart odoo).
  3. Verify Nginx configuration (sudo nginx -t).
  4. Reload the Nginx service (sudo systemctl reload nginx).
  5. Check Nginx access logs to confirm it sees the real client IP.
  6. Try logging into Odoo again and check the Odoo logs.

0
アバター
破棄
Takahiro SUNAGA

Hi, How about using the `set_real_ip_from` directive to solve this?
Here's the documentation:
https://nginx.org/en/docs/http/ngx_http_realip_module.html#set_real_ip_from

Best regards,

ディスカッションを楽しんでいますか?読むだけでなく、参加しましょう!

今すぐアカウントを作成して、限定機能を利用したり、素晴らしいコミュニティと交流しましょう!

登録
関連投稿 返信 ビュー 活動
Nginx odoo 16 proxy and method not allowed 405
nginx
アバター
アバター
2
9月 24
3753
I'm trying to edit sites-available and sites-enabled - Configuration Builtin server Odoo 17
NGINX
アバター
0
7月 24
1629
How can I setup odoo on a path with nginx
nginx
アバター
アバター
1
5月 24
4606
Nginx with Odoo configuration: host not found in upstream
nginx
アバター
アバター
アバター
2
5月 24
15960
Reverse Proxy Converts URL to Garbage 解決済
NGINX
アバター
アバター
1
7月 23
5925
コミュニティ
  • チュートリアル
  • ドキュメンテーション
  • フォーラム
オープンソース
  • ダウンロード
  • Github
  • Runbot
  • 翻訳
サービス
  • Odoo.shホスティング
  • サポート
  • アップグレード
  • カスタム開発
  • 教育プログラム
  • 会計事務所一覧
  • パートナー一覧
  • パートナーになる
企業情報
  • 会社概要
  • ブランドアセット
  • お問い合わせ
  • 採用情報
  • イベント
  • ポッドキャスト
  • ブログ
  • お客様一覧
  • リーガル情報 • プライバシーポリシー
  • セキュリティ
الْعَرَبيّة 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コマース、会計、在庫管理、POS、プロジェクト管理など、企業のさまざまな業務を一つのシステムで管理できる、ベルギー発のオープンソースのERPソフトウェアです。

高機能で使いやすく、完全に統合されたERPとして、ユニークな価値を提供しています。

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