Configuring Decidim environment variables in production
Environment variables are how a Decidim installation receives its runtime settings without code changes, so the same application can run in a test environment and in a live platform with different behavior. When you move from a test install to a live platform, these values decide whether traffic is forced onto HTTPS, how large uploaded files may be, how long a participant stays signed in, and who can reach the System panel. Set them deliberately before real participants arrive instead of relying on defaults you have not reviewed. Decidim is built on Ruby on Rails and PostgreSQL, and the variables sit alongside your install method, whether a manual Rails deployment or a Docker deployment, so the same review applies to both.
Three settings deserve a decision in every production review. DECIDIM_FORCE_SSL controls HTTPS enforcement when TLS is terminated by a proxy in front of Decidim, so confirm with your network team which layer handles certificates and that the application redirects or rejects plain HTTP as you intend. DECIDIM_MAXIMUM_ATTACHMENT_SIZE defaults to 10 MB, and your participation process should decide whether that limit fits the documents people will upload, while also checking the upload limits in your reverse proxy, which can reject files before Decidim sees them. DECIDIM_EXPIRE_SESSION_AFTER defaults to 30 minutes, a value that balances convenience for participants against exposure on shared computers, and public-sector teams often review it with their security or records owner.
Record the value you choose for each variable, the reason for it, and who approved it, because a change made during an upgrade or a container rebuild can silently reset behavior. Your deployment team should confirm the full variable list for your installed version in the Decidim environment variables documentation, since the reference covers throttling and System panel IP allowlist settings that need the same review. Test each change on a staging copy before it reaches production, and keep the values in the same secret or configuration store you use for database credentials, not in source control.
Which environment variables matter most and when each fits
This table compares the environment variables that most affect a production Decidim install, showing what each controls, its default where one is supplied, and when changing it fits. Read each row against your hosting model: whether a proxy terminates TLS, how large your uploads will be, and how long your staff and participants should stay signed in. Every change carries a trade-off, so confirm each key name and its exact behavior in the official environment variables documentation before you set it.
| Setting | What it controls | When it fits | Trade-off to weigh |
|---|---|---|---|
| DECIDIM_FORCE_SSL | Enforces HTTPS when TLS is handled by a proxy or load balancer in front of Decidim | Any production install reached over a public domain where the proxy terminates TLS | Misconfigured proxy headers can cause redirect loops, so test sign-in and admin access on staging first |
| DECIDIM_MAXIMUM_ATTACHMENT_SIZE | Caps the size of files participants and staff can upload, with a default of 10 MB | Raise it when your processes need larger documents, or lower it to limit storage growth | Higher limits increase storage, backup and proxy request size needs; confirm web server limits match |
| DECIDIM_EXPIRE_SESSION_AFTER | Sets how long an idle session stays valid, with a default of 30 minutes | Shorter sessions suit shared workstations and admin staff; longer ones suit participants on slow connections | Shorter expiry improves security but can interrupt long forms; longer expiry widens exposure on unattended devices |
| Throttling settings | Limits request rates to slow abusive traffic and brute-force attempts; key names to confirm in the docs | Public platforms expecting spikes in traffic or automated abuse | Strict limits can block legitimate users behind shared IP addresses, so test thresholds before launch |
| System panel IP allowlist settings | Restricts access to the System panel to approved IP ranges; key names to confirm in the docs | Installs where administrators work from known office or VPN networks | Allowlists need updates when staff networks change, and they can lock out administrators if misconfigured |
Setting and verifying environment variables before launch
This sequence turns a list of Decidim settings into a tested configuration, so that TLS enforcement, upload limits, throttling, session expiry and System panel access behave as intended before participants arrive. Each step ends with a check you can record for the launch review.
Inventory the variables your install reads
Before changing anything, list every environment variable your deployment sets or depends on, and compare the names against the environment variables documentation for the exact Decidim version you run. Variable names can differ between minor versions, so confirm each one rather than copying names from older guides or blog posts. Record the current value, the intended value and the owner of each setting, including the ones your hosting provider or container platform injects. The output is a single reviewed table that the engineer and the security reviewer both sign off on.
Set values in the deployment environment
Write the agreed values into the place your process actually reads them: the process manager's unit file or environment section, the container orchestrator's configuration, or the environment of the Rails process if you run it directly. Keep secrets out of shared configuration files and out of version control, and store them in your secrets manager. Check that no variable is set in two places with different values, because the winning value is not always the one you expect. The output is a deployment configuration that differs from the previous one only in the reviewed lines.
Restart web and job processes together
Restart the web processes and the background job processes after the change, since both read the environment at startup and a job worker running old values can behave differently from the web tier. If you run the platform in containers, recreate the containers instead of only reloading the image. Confirm that each process started cleanly and that the logs show no configuration errors. The output is a record of which processes were restarted and when, so the verification steps below can be tied to a known configuration.
Test an upload near the attachment limit
Using a test account in a non-production organization or a staging copy, upload one file just under the configured attachment limit and one just over it. The default maximum attachment size is 10 MB unless your environment sets a different value, so check which value is active in your running configuration. Confirm that the first file is accepted and the second is rejected with a clear message, and check the web server and any reverse proxy limits as well, since they can reject a request before Decidim sees it. The output is a pair of recorded results for each limit that the team has agreed to.
Check HTTP to HTTPS redirect behavior
If TLS terminates at a proxy or load balancer, confirm the forced SSL setting works as intended by requesting the site over plain HTTP from outside your network and following the redirects. Check that every public path ends on HTTPS, that the proxy forwards the protocol header Decidim relies on, and that no redirect loop appears on the login or admin pages. Verify the same behavior for each host that serves an organization. The output is a short log of the request, the redirect chain and the final protocol for each host tested.
Confirm session expiry matches the setting
Sign in with a test account, leave the session idle for the configured expiry period, and then attempt an action that requires authentication. The documented default session expiry is 30 minutes, so if your configuration changes it, test against your value rather than the default. Confirm the user is signed out and asked to authenticate again, and that no sensitive page remains usable after expiry. The output is a recorded timestamp of sign-in, the expiry period tested and the observed sign-out.
Verify System panel IP allowlist and throttling
From an address inside the allowlist and one outside it, attempt to reach the System panel and confirm that only the permitted address gets through. Then send repeated requests to a throttled endpoint, such as sign-in, and confirm that the throttle responds as configured. Ask the platform team to confirm that the client IP seen by Decidim is the real visitor address and not the proxy address, because an allowlist built on the wrong address either blocks administrators or allows everyone. The output is a written record of allowed and denied results that the launch owner keeps with the configuration baseline.
Record the baseline and schedule a retest
Save the final list of variables, values (with secrets masked), test results and the Decidim version they apply to in your configuration repository or change log. Repeat the same tests after every upgrade, host change or proxy change, because those events can alter header handling and default behavior. Ask the vendor or your own documentation owner to confirm any variable whose behavior you could not reproduce during testing. The output is a versioned baseline that the next engineer can use to check drift.
How SSL enforcement, proxies and sessions interact
DECIDIM_FORCE_SSL only matters when TLS is terminated by a proxy in front of Decidim, so the first check is where the padlock is actually issued. If a load balancer or reverse proxy handles HTTPS and forwards plain HTTP to the Rails application, the application cannot see that the visitor arrived over TLS unless the proxy passes the right forwarding headers. A proxy that drops or rewrites X-Forwarded-Proto can produce redirect loops, mixed-content warnings on forms and assets, or login pages that appear to be served over HTTP. The reverse failure also happens: TLS terminated at two layers, such as a CDN and an ingress controller that each handle certificates and rewrite headers, can leave the application seeing conflicting protocol information. Confirm with your platform team which hop terminates TLS, which headers each hop sets, and test sign-in, password reset links and uploads from an outside network before go-live.
Session expiry and attachment limits look like back-office settings, but they reach participants and administrators in different ways. DECIDIM_EXPIRE_SESSION_AFTER defaults to 30 minutes, and a participant who drafts a long proposal or comment may lose it when the session ends before submission. Administrators are more likely to notice the setting through repeated re-logins during moderation or configuration work, so a shorter value that suits a public audience can be frustrating for staff. DECIDIM_MAXIMUM_ATTACHMENT_SIZE defaults to 10 MB, which affects citizens uploading photos or documents to proposals and is a different concern from the administrators who manage exports and imports. Ask the business owner which user group the change hits hardest before changing either value.
A change to any of these settings can surprise users if it is not communicated, because the failure looks like a bug from the participant side. Plan a short notice on the platform and in the relevant help pages before the change, state the new session length and upload limit in plain terms, and agree a rollback value with the operations team. Test the change on staging first, using the same proxy chain as production, and record which environment variables were changed and when, so support staff can match a wave of complaints to a deployment. Confirm the exact behavior of each variable against the environment variables documentation for the Decidim version you run, since defaults and handling can change between releases.
Security risks of misconfigured environment settings
Most of Decidim's production security depends on a short list of environment variables set once at deployment. Each card below pairs one misconfiguration with its consequence and the control your team should confirm before participants arrive.
Plain HTTP behind a proxy
When TLS terminates at a reverse proxy or load balancer, the Rails app can still answer requests over plain HTTP unless HTTPS enforcement is set. Login credentials and session cookies then travel unencrypted on any hop the proxy does not protect. Confirm that DECIDIM_FORCE_SSL is enabled in every production and staging environment, that the proxy forwards the original protocol correctly, and that plain HTTP requests redirect to HTTPS.
Sessions that outlast the visit
A long session lifetime lets someone who reaches an unlocked browser on a shared computer keep access to a participant or administrator account. Public participation platforms see this often in libraries, council offices and community centers. Check the value of DECIDIM_EXPIRE_SESSION_AFTER against your own risk tolerance, and confirm that administrators get a shorter window than ordinary participants if your policy allows different settings.
- Default session expiry
- 30 minutes
System panel open to the internet
The System panel manages organizations, hosts and platform-wide settings, so it is the most sensitive area of a Decidim install. Without an IP allowlist, anyone who finds the login page can attempt to sign in from anywhere. Confirm the allowlist variable is set to the address ranges your administrators use, test it from an address outside the list, and confirm that the panel is not reachable through the public hostname used for participants.
Upload limits larger than your controls
A high attachment ceiling lets one upload consume disk, memory and processing time before anyone reviews the file. The limit should match what your storage, malware scanning and moderation process can handle. Review DECIDIM_MAXIMUM_ATTACHMENT_SIZE against the storage capacity and scanning you run, and confirm with your hosting team how uploads are checked before publication. The default is 10 MB, so any increase should be a deliberate decision.
Secrets stored in version control
Secret keys, database passwords and SMTP credentials committed to a repository are exposed to everyone with read access, and copies persist in clones, forks and backups even after removal. This is especially risky for Decidim because the same repository often holds custom modules and deployment scripts. Confirm that secrets are injected at deploy time from a secrets manager or the platform's secret store, that repository history has been scanned, and that any exposed value has been rotated.
Common questions about Decidim environment configuration
How much effort does it take to configure Decidim environment variables?
The variable settings themselves are small, but the effort depends on how many of them your deployment needs and how much of the surrounding environment must be confirmed first. Setting DECIDIM_FORCE_SSL for a proxy-terminated site is a short change; verifying that the proxy forwards the right headers, that redirects do not loop, and that uploads and sessions behave correctly takes longer. Effort grows with the number of environments (production, staging, a second region), the container or manual install method, and whether secrets are managed through a vault or plain files. Ask any partner to break the quote into discovery, change, and verification steps so you can see where the time goes.
Can our internal team configure these settings without a partner?
Yes, if your engineers can read the Decidim environment variables documentation, have access to the deployment environment, and can test the result in a non-production copy. The settings are documented in the Decidim environment variables docs, and most teams with Rails or container experience can apply them. A partner adds value mainly when the security review, proxy behavior, admin network design, or audit evidence must be produced for a compliance team. Confirm internally who owns the proxy, who approves the admin allowlist, and who will retest after each change.
What does the work need from our team?
A configuration review needs three things from your side: access to the deployment environment where variables are set (container orchestration, systemd units, or the hosting panel), the reverse proxy or load balancer configuration including how TLS terminates and which headers are forwarded, and the list of networks that should reach the System panel. Without the proxy configuration, TLS enforcement cannot be verified. Without the admin network list, the allowlist cannot be set safely. Also prepare a current inventory of existing variable values so changes can be compared and rolled back.
How long does a configuration review take depending on scope?
Duration depends on scope, not on a fixed figure. A review limited to a single organization with one proxy and a short list of variables is much smaller than a review covering several environments, multiple organizations, custom authentication, and an upgrade plan. The main drivers are the number of environments, how many variables are in use, how many people must approve network and session policies, and whether staging is available for testing. Ask for the expected duration in the written scope, with the environments and variables it covers listed explicitly.
Do environment variables change during Decidim upgrades?
Some settings may need review during an upgrade, because release notes and the update guide can introduce new variables, rename existing ones, or change defaults. Decidim's update guide advises moving one minor version at a time and following each release's upgrade instructions, since some releases change database structures. Before upgrading, compare your current variables against the documentation for the target version, and test the new configuration on a copy of production. Do not assume a value that worked on the previous version still has the same meaning.
What should we check if sessions expire too early or uploads fail?
Start with the variables that control the behavior you see. DECIDIM_EXPIRE_SESSION_AFTER defaults to 30 minutes, so a shorter value explains participants being logged out sooner than expected. DECIDIM_MAXIMUM_ATTACHMENT_SIZE defaults to 10 MB, so uploads above that limit will be rejected. Check whether a proxy also enforces its own request body size, since that limit can fail uploads before Decidim sees them. Confirm the values in each environment, because staging and production often differ.
Does DeployOpen configure these settings for us, and what does it deliver?
DeployOpen plans, implements, hardens, and documents self-hosted open-source platforms inside your own infrastructure, which includes setting and reviewing Decidim environment variables against your proxy, identity, and admin network requirements. Most engagements are fixed-scope, with scope, deliverables, and timelines agreed in writing before work starts. Deliverables can include the configuration change record, verification results on staging, and the documented admin allowlist. DeployOpen does not issue audit reports or certifications; those come from independent assessors.
How a request passes through the proxy, Decidim and job processes
A browser request starts at the TLS proxy, which terminates HTTPS before forwarding it to the Decidim web process. That process reads its environment variables at boot, including DECIDIM_FORCE_SSL, DECIDIM_MAXIMUM_ATTACHMENT_SIZE and DECIDIM_EXPIRE_SESSION_AFTER, then reads and writes PostgreSQL and stored attachments through ActiveStorage. Background job workers read the same variables, so a value set for one process must match the other. Check the trust boundary at the proxy and confirm which admin network ranges the System panel accepts.
Request path through the proxy, Decidim web and job processes, with shared configuration.
Managing environment changes across staging and production
Treat every environment variable as a configuration change that needs a record. Keep the non-secret values for each Decidim environment in version-controlled files or in a configuration store your team already audits, so that a change to DECIDIM_FORCE_SSL, DECIDIM_MAXIMUM_ATTACHMENT_SIZE or DECIDIM_EXPIRE_SESSION_AFTER shows who changed it, when, and why. Compare the staging and production values regularly. Drift between the two is one of the most common reasons a fix that worked in testing behaves differently for real participants. Secrets such as database passwords, SMTP credentials and OAuth client secrets belong in a secrets manager or the platform's secret store, never in a repository or in a file that is copied into an image. Confirm with your deployment method (manual Rails install or Docker) where each secret is read at runtime, and rotate any value that has ever been committed.
Test each variable change on staging before production, using the same container image or application release and the same proxy and TLS arrangement as production. A change to session expiry or upload limits is cheap to verify: sign in, wait out the timeout, and try a file just above and just below the limit. Check the result against the environment variables documentation for the release you run, because defaults and names can change between versions. Staging should mirror production closely enough to catch these differences, but it should never receive live participant data or live outbound mail. The procedure for building that copy is covered in the staging topic.
Variables are not stable across upgrades. Decidim's update guide asks you to move one minor version at a time, for example 0.29 to 0.30 before 0.31, and to follow each release's upgrade instructions, which can change database structures and configuration. Before you upgrade, read the release notes and the environment variables page for the target version, compare them with your current file, and add any new settings to staging first. Take a database backup before the change, as the update guide advises. Keep a dated record of each variable set, so that if an upgrade must be rolled back you can restore the exact configuration that matched the previous release.
Official sources to read before changing settings
This sequence gets the team reading the authoritative Decidim documents before any environment variable changes. The result is a short written list of settings to change, the version they apply to, and the upgrade constraints that could affect them.
Confirm the Decidim version you run
The platform team checks the exact Decidim version in the Gemfile.lock or the deployed release tag, not the version the team remembers. Decidim only receives security updates for its last two minor versions until version 1.0, so the version determines which documentation applies. Done when the version number is written in the change ticket and matched to a supported branch on the releases page.
Read the environment variables reference
The platform lead reads the Decidim environment variables documentation end to end before editing any configuration file. Pay attention to the variables that control HTTPS enforcement behind a proxy, attachment size limits and session expiry, since the defaults for attachment size and session timeout are stated there. Done when each setting you plan to change has a documented purpose and default recorded in your notes.
Check the manual installation guide
The engineer responsible for the server reads the manual installation guide to confirm the runtime and database requirements for your version, including the Ruby, Node and PostgreSQL versions listed for each release line. This shows which environment variables your deployment method reads at startup and where they are set. Done when the runtime versions on your servers or container images match the guide, or a mismatch is logged as a task.
Read the update guide before any version change
Before changing settings that could alter behavior across a release, the team reads the update guide. It explains that Decidim moves one minor version at a time, that some releases change database structures, and that the database should be backed up first. Done when the team has noted the upgrade path from its current version and whether any planned setting change should wait for an upgrade.
Record the settings to change and their owners
The platform lead lists each environment variable the organization intends to set, the reason for it, the current value and the owner who approves the change. Security-relevant settings such as HTTPS enforcement, session expiry and System panel access need sign-off from the security team. Done when the list is stored with the change ticket and every row has a named approver.
Confirm the settings in a non-production copy
The engineer applies the listed variables to a staging environment that matches production's proxy, domain and runtime setup, then checks that the application starts and that the affected pages behave as expected. Testing with a copy of production data is covered elsewhere, so this step only confirms that the settings load and take effect. Done when the staging logs show the values in use and the test cases for each setting pass.
How DeployOpen configures Decidim environments
DeployOpen treats Decidim environment variables as part of the deployment design, not an afterthought. We agree the production values in writing, build and test them in your infrastructure, and hand over a documented configuration your team can review and change.
How we scope
- Written scope lists which environment variables are set, and which values your security and legal teams must approve.
- We confirm how TLS terminates, whether a proxy sits in front of Decidim, and which hosts each organization uses.
- Engagements are fixed-scope, with deliverables and timelines agreed in writing before configuration work starts.
How we build
- We set SSL enforcement, attachment size, throttling, session expiry and System panel IP allowlists in your chosen environments.
- Each value is tested against the expected behavior, including redirects over HTTP and uploads at and above the limit.
- Staging and production files are kept separate so values are reviewed before they reach participants.
How we hand over
- You receive a documented list of every variable we set, its value, the reason for it and the file or secret store holding it.
- Secrets are handled in your own secret management, and we record who can change each value and how changes are reviewed.
- Your team gets a walkthrough of how to confirm each setting after a restart, upgrade or infrastructure change.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers, so configuration stays aligned with each Decidim release.
- When a new Decidim version changes variable names or defaults, we review the impact before the upgrade is scheduled.
- Configuration changes after launch follow the same written scope and test steps as the original deployment.

