Skip to content

fix: resolve nginx envsubst invalid variable name error#38

Merged
Feikovandijk merged 1 commit intomainfrom
hotfix/nginx-envsubst-fix
Feb 21, 2026
Merged

fix: resolve nginx envsubst invalid variable name error#38
Feikovandijk merged 1 commit intomainfrom
hotfix/nginx-envsubst-fix

Conversation

@Feikovandijk
Copy link
Owner

  • Remove double dollar sign escaping from nginx variables in default.conf.template
  • Add NGINX_ENVSUBST_FILTER to docker-compose.yml to restrict envsubst to only process BACKEND_URL, API_URL, and FRONTEND_URL variables
  • Prevents envsubst from replacing nginx own variables (host, uri, etc.)

- Remove double dollar sign escaping from nginx variables in default.conf.template
- Add NGINX_ENVSUBST_FILTER to docker-compose.yml to restrict envsubst to only process BACKEND_URL, API_URL, and FRONTEND_URL variables
- Prevents envsubst from replacing nginx own variables (host, uri, etc.)
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Feikovandijk, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses an issue where Nginx's envsubst utility was incorrectly interpreting Nginx's own variables due to improper escaping, leading to errors. The changes involve correcting the Nginx configuration template by removing unnecessary double dollar signs and explicitly defining a filter in the Docker Compose setup to restrict envsubst to only process specific application-related environment variables, thereby ensuring stable Nginx operation.

Highlights

  • Nginx Variable Escaping: Removed redundant double dollar sign escaping ($$) from Nginx variables in default.conf.template to resolve envsubst errors.
  • envsubst Filtering: Introduced NGINX_ENVSUBST_FILTER in docker-compose.yml to explicitly define which environment variables (BACKEND_URL, API_URL, FRONTEND_URL) envsubst should process.
  • Preventing Nginx Variable Overwrites: Configured envsubst to prevent it from inadvertently replacing Nginx's internal variables (like $host, $uri, etc.) by limiting its scope.
Changelog
  • docker-compose.yml
    • Added NGINX_ENVSUBST_FILTER environment variable to the user-dashboard service, specifying BACKEND_URL|API_URL|FRONTEND_URL as the variables to be processed by envsubst.
  • user-dashboard/default.conf.template
    • Modified map directive to use single dollar signs for Nginx variables ($http_x_forwarded_proto, $proxy_x_forwarded_proto, $scheme).
    • Updated try_files directive to use single dollar signs for Nginx variables ($uri).
    • Corrected proxy_set_header directives to use single dollar signs for Nginx variables ($host, $remote_addr, $proxy_add_x_forwarded_for, $proxy_x_forwarded_proto).
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request effectively addresses the envsubst invalid variable name error by removing double dollar sign escaping from Nginx variables and restricting envsubst to specific variables. This is a good fix for the identified issue.

@Feikovandijk Feikovandijk merged commit f0e87b5 into main Feb 21, 2026
5 checks passed
@Feikovandijk Feikovandijk deleted the hotfix/nginx-envsubst-fix branch February 21, 2026 17:32
@Feikovandijk Feikovandijk restored the hotfix/nginx-envsubst-fix branch February 21, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant