Why teams put Odoo behind Nginx with SSL and websockets
A self-hosted Odoo server that must serve users over HTTPS on a company domain needs a reverse proxy in front of it. Nginx terminates TLS and forwards traffic to Odoo's HTTP port and its longpolling or websocket port. Odoo's own workers speak plain HTTP, so the certificate, the redirect from port 80 and the public hostname all live at the proxy, while Odoo listens on its internal ports. This arrangement is the same whether you run the Community edition or the Enterprise edition, because the web server layer sits outside the application and the two editions share the same HTTP serving model. The difference between editions lies in the subscription and the source code, not in how traffic reaches the server.
You need the proxy when users reach Odoo from a browser over a company domain, when you want HTTPS enforced, or when live features such as chat, notifications and discuss depend on the websocket path. A lab install reached only on a private address on port 8069 may not need one. Decide this before the build starts, because the proxy changes which hostname Odoo sees, which scheme it generates in links and reports, and whether session cookies can be marked Secure. Confirm with your network team who owns the certificate, the DNS record and the firewall rules for ports 80 and 443, and confirm that the internal Odoo ports are not reachable from users directly.
Choosing this setup early also sets the test plan. Once the proxy is in place, you must check that login, the websocket connection, PDF generation and file downloads all work through the public hostname, not only through the internal address. Ask your implementation partner or internal team to document the proxy configuration as part of the server build, so that certificate renewal, Nginx upgrades and any later move of Odoo to another host are planned work rather than emergencies.
How a browser request reaches Odoo through Nginx
A browser request starts on the public network and reaches Nginx on port 443, while plain HTTP on port 80 is redirected to HTTPS. Nginx then forwards ordinary requests to the Odoo HTTP upstream on port 8069 and requests to the /websocket path to the upstream on port 8072. Odoo reads and writes PostgreSQL on the internal host. Check that the trust boundary sits where you expect, that only Nginx is reachable from outside, and that Odoo's own ports are not exposed to the public network.
Request path from the browser through Nginx to Odoo and PostgreSQL, with the trust boundary marked.
Which Nginx settings to choose and when each fits
This table compares the Nginx and odoo.conf settings that tell Odoo which scheme, client address and hostname the browser used, and how sessions and connections behave. Read each row for what the setting does, the layout it suits and the symptom when it is wrong. The main takeaway is that proxy headers, proxy_mode and the public hostname must agree, or links, sessions and database selection tend to fail together.
| Setting | What it does | When it fits | What breaks if wrong |
|---|---|---|---|
| proxy_mode = True | Tells Odoo to read forwarded scheme, host and client address from the proxy | Single host behind one Nginx: enable. Multi-host: enable only if Nginx is the sole path to Odoo | Generated links use the wrong scheme; logs show the proxy address for every client |
| X-Forwarded-Proto | Tells Odoo whether the browser connection used HTTPS | Set to $scheme on every location that proxies to Odoo | Odoo generates http URLs on an https site, causing mixed content or redirect loops |
| X-Forwarded-For | Carries the original client address through the proxy chain | Set to $proxy_add_x_forwarded_for on the Nginx that faces users | Rate limits and IP-based logs see one address; multi-proxy chains need trusted hops only |
| X-Forwarded-Host | Keeps the public hostname the browser requested | Match the public hostname exactly on each server block | Wrong database chosen under dbfilter; report and website links point to internal names |
| Proxy timeouts | How long Nginx waits for Odoo, including long reports and imports | Raise only on the locations that run heavy jobs; confirm against your slowest reports | Too short: 502 or 504 errors while Odoo still works; too long holds connections open |
| HSTS header | Tells browsers to use HTTPS only for the host for a set period | Enable after HTTPS works on every hostname and subdomain served | Hostnames still on plain HTTP become unreachable for browsers that cached the policy |
| Secure cookie flag | Stops the session cookie being sent over plain HTTP | Enable on HTTPS-only sites; confirm how your Odoo version sets the flag | Login loops if the cookie is marked Secure while users reach the site over HTTP |
| SameSite cookie attribute | Limits when browsers send the session cookie on cross-site requests | Test sign-in from external links, embedded views and payment return pages before choosing a value | Overly strict values can end sessions on links from other sites; None requires Secure |
| Websocket upgrade on /websocket | Lets the bus connection upgrade to a persistent socket on port 8072 | Required on single-host and multi-host layouts that route /websocket to the longpolling port | Live chat and notifications stall or fall back to polling, adding load on workers |
Configuring Nginx for Odoo step by step
This sequence places Nginx in front of Odoo so users reach it over HTTPS on standard ports, while Odoo keeps serving its web and live-update traffic on its own internal ports. Each step ends with a check you can run before moving on, so a fault is traced to the step that caused it.
Install Nginx and obtain a certificate
A systems administrator installs Nginx from the distribution packages on the server that runs Odoo, opens ports 80 and 443 in the firewall, and obtains a TLS certificate for the public hostname. The certificate can come from a public certificate authority or your internal CA, and the file should include the intermediate chain. Confirm the renewal process now, because an expired certificate blocks every session. Check:
nginx -treports a valid configuration, and the hostname resolves to the server from the network your users use.Define upstreams for ports 8069 and 8072
In the Nginx configuration, the administrator declares two upstream blocks that point at the local Odoo processes: one for the web application on port 8069 and one for the longpolling and websocket service on port 8072. Both point to 127.0.0.1 when Odoo runs on the same host. Keep these ports closed to external networks, so all user traffic passes through Nginx. Check: with Odoo started,
ss -ltnpshows both ports listening on the loopback address, and nothing else on the network reaches them.Add the HTTP to HTTPS redirect
The administrator adds a server block that listens on port 80 for the Odoo hostname and returns a permanent redirect to the HTTPS address for the same path. This makes sure users and bookmarks that start with http:// land on the encrypted site. The redirect block should not proxy any traffic to Odoo. Check: a request such as
curl -Iagainst the plain HTTP address returns a 301 response whose Location header begins with https:// and uses the same hostname.Configure the HTTPS server and proxy headers
The administrator adds the HTTPS server block with the certificate and key paths, then sets a proxy_pass to the web upstream. The block also sets the X-Forwarded-Host, X-Forwarded-For, X-Forwarded-Proto and X-Real-IP headers, so Odoo can see the original host, client address and scheme. Set proxy timeouts and client_max_body_size to values that match your longest reports and file uploads, using the figures in Odoo's documentation for your version. Check:
nginx -tpasses, the reload succeeds, and the login page loads in a browser over HTTPS without certificate warnings.Add the websocket location
The administrator adds a location block for the path /websocket that proxies to the longpolling upstream on port 8072. The block sets HTTP version 1.1 and the Upgrade and Connection headers, because the websocket handshake depends on them. Without this location, live features such as chat and notifications fall back or fail. Check: in the browser developer tools, the websocket request shows status 101 Switching Protocols, and the connection stays open while the user stays on a page that uses live updates.
Enable proxy mode in odoo.conf
The administrator sets
proxy_mode = Truein the odoo.conf file, so Odoo reads the forwarded headers that Nginx sends, then restarts the Odoo service. Without this setting, Odoo generates links and redirects with the internal address and scheme. Confirm the setting matches the file that the service actually loads. Check: after the restart, the login redirect and any generated links use the public HTTPS hostname, and the browser console reports no mixed-content warnings.Set HSTS and secure session cookie flags
The administrator adds a Strict-Transport-Security header to the HTTPS server block, starting with a modest max-age value that the team can extend later, and confirms that Odoo's session cookies carry the Secure and SameSite attributes for the version in use. Check the exact cookie behavior in Odoo's documentation for your version and in a test login, because the attributes depend on the release and on proxy_mode. Verification:
curl -Ishows the HSTS header on the HTTPS response, and the browser's cookie inspector shows the session cookie marked Secure with the expected SameSite value.
How the websocket route and session cookies behave behind a proxy
The /websocket location must reach the longpolling or websocket process on port 8072 separately from normal web traffic on port 8069. Odoo uses that channel for live features such as bus notifications, so if the proxy sends those requests to the regular web workers, the notifications fail quietly while ordinary pages still load. Keep the websocket upstream as its own block, and confirm in your Odoo version's documentation which process serves it, since the way longpolling and websocket workers are configured has changed across releases. Test with the browser's developer tools open and watch for failed or repeatedly reconnecting requests to /websocket after login.
The scheme and host the proxy passes on decide what Odoo believes about the request. When proxy_mode is enabled, Odoo reads the X-Forwarded headers to learn the original scheme and host. If the proxy sends plain HTTP upstream, or forwards a host header that does not match the public name users type, Odoo can generate redirects after login, build links that point at the wrong address, or set the session cookie without the Secure attribute even though users reach the site over HTTPS. Set X-Forwarded-Proto to https, pass the public Host`, and check that redirects after sign-in stay on the HTTPS address.
To verify the session cookie flags, sign in over HTTPS, open the browser's developer tools, and inspect the cookie for the Odoo session under the storage or cookies panel. Confirm that it carries the Secure flag, that HttpOnly is set, and that the SameSite value matches what your deployment needs. Then sign out, sign in again, and repeat the check, because a cookie set on a redirect from an HTTP address may look different from one set on the HTTPS address. Record the results for each Odoo version you run and confirm the expected cookie behavior with the documentation for that version.
Security settings for a proxied Odoo server
Once Nginx terminates TLS in front of Odoo, the proxy becomes the only trusted entry point, so the certificate, the open ports, the database manager and the logs all need to be set with that in mind. The cards below cover the settings that connect those decisions and the checks to run after each change.
TLS certificate handling and renewal
Nginx holds the certificate and private key for the public hostname, so its file permissions and renewal process are part of the Odoo security boundary. Confirm that the private key is readable only by the Nginx master process, that the certificate covers every hostname Odoo serves, and that renewal reloads Nginx without a restart. Expired certificates break websocket connections and the longpolling features that depend on them, so test renewal on a staging hostname before relying on it. Keep the certificate chain and cipher configuration under the same review as the rest of the proxy config.
HSTS and its rollout risk
HTTP Strict Transport Security tells browsers to use HTTPS for the hostname for a set period, which protects returning users from downgrade attacks. The risk is that a misconfigured or expired certificate, or a subdomain without HTTPS, becomes unreachable for every browser that has cached the header. Start with a short max-age, confirm that every subdomain under the same parent serves HTTPS before adding includeSubDomains, and raise the value only after a stable period. Record who owns the decision to change the header.
Restricting direct access to ports 8069 and 8072
Odoo's HTTP server listens on 8069 and the longpolling or websocket service on 8072, and both should be reachable only from the Nginx host or the internal network segment it uses. Bind Odoo to a loopback or private address where your deployment allows it, and set firewall rules that drop traffic to these ports from outside. Without this, a client can bypass the proxy, skip the HTTPS redirect and send forged X-Forwarded headers directly to Odoo. Verify from an external host that both ports are closed.
Database manager behind the proxy
The database manager is a web interface that can create, drop, back up and restore databases, so it should not be reachable through the public hostname. Block the /web/database paths at Nginx, set a strong admin_passwd in odoo.conf, and consider disabling the manager entirely once databases are created. Test that the block returns the expected response from the public site and from unauthenticated clients. Hardening detail, including master password handling and brute force protection, is covered in the Odoo security hardening content group.
Forwarded header trust limits
Proxy mode tells Odoo to read client address and protocol from the X-Forwarded-* headers, which is only safe when Nginx sets those headers itself and overwrites any value sent by the client. Confirm that Odoo accepts forwarded headers only from the proxy address, and that proxy_set_header replaces rather than appends the values Nginx receives. Session cookie flags and the HTTPS redirect rely on the protocol header, so a spoofed value can weaken both. Check the results with a request that sends false forwarded values from outside the proxy.
Access logs that avoid sensitive data
Nginx access logs record the request line, which can include query strings with tokens, reset links or search terms, and Odoo logs can contain record names and user identifiers. Decide which fields the log format keeps, strip or hash query strings on sensitive paths, and set a retention period that your privacy and audit policies require. Restrict read access to the log files and forward them only to systems your organization controls. Confirm the chosen retention with your data protection owner before go-live.
Questions teams ask before configuring Odoo behind Nginx
Is a reverse proxy required to run Odoo with SSL?
A reverse proxy is the setup Odoo's documentation describes for HTTPS and websockets in production, and most teams put one in front of their Odoo servers. Odoo serves web traffic on port 8069 and the longpolling and websocket service on port 8072, so a proxy can terminate TLS in one place, route the /websocket path to the right port and pass the original scheme and client address through X-Forwarded headers. Without a proxy, you would expose application ports directly, manage certificates somewhere other than the proxy and have fewer controls for HSTS and timeouts. Confirm the exact settings for your Odoo version in the installation documentation before you decide the topology.
How much effort does an Nginx setup for Odoo take?
Effort depends on the shape of your environment more than on Nginx itself. The main drivers are the number of hostnames, since each database domain needs its own server block and certificate, the certificate method and how renewal is automated, and whether load balancers or several Odoo application servers sit in front. Static file offload, HSTS and Secure SameSite cookie settings add review work, and every change needs testing across login, live chat, report downloads, email links and file uploads. A small single-hostname setup is a contained task. A multi-company or multi-region setup with several hostnames is a project with its own test cycle.
Can an in-house administrator configure Odoo behind Nginx alone?
An administrator who already runs Nginx, TLS and Linux services and knows where Odoo's configuration file lives can usually make the change alone. The risk sits in the details that do not show up at first: a session cookie without the right Secure or SameSite flags can cause login loops, a missing websocket location breaks live features silently, and a wrong scheme in the proxy headers produces links and redirects that point to HTTP. A second person should review the configuration, and the change should be tested on a staging copy before production. Ask whether your team has someone who has done this more than once.
What does an Nginx and Odoo change need from our team?
Your team needs to supply a few things before any configuration starts:
- Domain names and access to the DNS zone so records can point at the proxy
- A way to issue and renew certificates, and the name of the person who owns renewals
- Root or sudo access to the proxy and Odoo servers, plus a maintenance window
- The Odoo version, edition, deployment method and a list of hostnames and databases
- A staging environment and a written test plan covering login, websockets, reports, emails and file downloads
The test plan matters most. Without agreed acceptance checks, it is hard to tell when the change is finished.
How long does a typical Nginx and SSL change for Odoo take?
The duration depends on the number of hostnames, whether a staging copy of the database exists, how quickly certificates can be issued, how many change windows your organization allows, and how deep the testing needs to go. A single hostname with a staging environment moves faster than a set of production domains with load balancers and compliance evidence to collect. Ask any provider for a written schedule tied to the agreed scope, listing the milestones, the test cycles and the points where your team must approve or provide access.
What happens after go-live with certificates and Odoo upgrades?
After go-live, the certificates need renewal on the schedule set by the certificate authority, and the renewal process must reload Nginx without breaking sessions. Confirm that renewal is automated, that expiry is monitored and that someone is named to respond to failures. Each Odoo major upgrade can change the proxy requirements, so the configuration should be reviewed as part of the upgrade plan. Odoo's standard support covers the first three years after a major release, and Odoo 19.0 is supported until September 2028. On Odoo Online and Odoo.sh, major upgrades are mandatory every two years. On-premise upgrades through the upgrade service need an Enterprise subscription.
Does the Nginx setup depend on our Odoo edition or plan?
The proxy configuration itself does not depend on the edition, and teams running Community can use the same reverse proxy pattern. The hosting choice does matter. Odoo's pricing page lists the Custom plan as the only one that can be hosted on Odoo.sh or on-premise, so an on-premise proxy setup is tied to that plan. Enterprise on-premise databases are activated with a subscription code. Confirm the plan, licensing terms and any Enterprise requirements with Odoo before you commit to a hosting design, because those decisions affect who can change the proxy and where it runs.
Operating the Nginx layer after go-live
The Nginx layer needs its own operating routine after go-live, because most of the failures that reach users, such as expired certificates, stalled live updates or sessions that drop at login, start in the proxy rather than in Odoo. Assign an owner for the proxy, set up alerts on the Nginx error log and on the Odoo log for upstream timeouts and connection errors, and review both logs after every Odoo update. Watch for repeated 502 or 504 responses on the /websocket location, since the longpolling and live chat features depend on it. Confirm that the log format records the forwarded client address, so that an investigation can tell real users from the proxy itself.
Certificate renewal deserves a scheduled check instead of trust in an automated job. Confirm which tool issues the certificate, when it renews, and that the reload hook runs after each renewal, then verify the served certificate's expiry date from outside the network. Keep the HSTS max-age value in mind before changing or removing the header, because browsers that cached it will keep enforcing HTTPS for that period. After any change to the domain, the certificate, or the web.base.url value, check that the Secure and SameSite attributes on the session cookie still match the scheme users reach.
Timeouts need review whenever Odoo is upgraded, since a new version can change how long long-running reports, imports or scheduled jobs take. Compare the proxy_read_timeout and proxy_send_timeout values with the request durations in the Odoo log, and check that they still exceed the slowest legitimate request without holding connections open for longer than needed. Put the proxy configuration, the Nginx upstream definitions for ports 8069 and 8072, and the matching odoo.conf settings in the same version control repository, and change them through the same review. After each change, re-test login, a live chat or bus notification, a PDF report, and a session that stays open across a proxy reload, because a change that passes a status check can still break these flows.
How DeployOpen scopes and delivers the Nginx setup
DeployOpen plans the Nginx layer for Odoo as part of the wider deployment, not as an afterthought. Each engagement is agreed in a written, fixed scope that names the domains, ports, certificates and the network path Odoo must serve through.
How we scope
- Confirm public hostnames, TLS certificate source and the Odoo ports 8069 and 8072 the proxy must reach
- Record which Odoo database and dbfilter pattern each hostname maps to before configuration starts
- Agree in writing whether proxy mode, websocket routing and HSTS are in the fixed scope
- Identify any load balancer, CDN or upstream proxy in front of Nginx that changes forwarded headers
How we build
- Write the Nginx server blocks for HTTP to HTTPS redirect, the upstreams and the /websocket location
- Set proxy_mode, X-Forwarded headers and timeouts to match the Odoo version and the network path in use
- Configure Secure and SameSite session cookie behavior and test sign-in through the proxy
- Test each hostname end to end, including reports and websocket-dependent screens, before handover
How we hand over
- Deliver the Nginx configuration files, certificate renewal steps and the matching odoo.conf settings
- Document the verification checks used, such as header inspection and login and websocket tests
- Record the rollback steps and the order to change Nginx and Odoo during future upgrades
- Walk through the handover with your platform and security teams so they can review the setup
How we support
- Offer ongoing support, upgrades and continuous testing as a retainer after the fixed-scope work ends
- Retest the proxy configuration when Odoo versions, certificates or network paths change
- Confirm the Odoo support window for your version before scheduling an upgrade of the proxy setup
- Review proxy settings as part of any broader security testing of your Odoo deployment

