Skip to content

Allowed hosts config#4471

Open
neolefty wants to merge 6 commits into
SpeciesFileGroup:developmentfrom
neolefty:allowed-hosts-config
Open

Allowed hosts config#4471
neolefty wants to merge 6 commits into
SpeciesFileGroup:developmentfrom
neolefty:allowed-hosts-config

Conversation

@neolefty

@neolefty neolefty commented Jul 9, 2025

Copy link
Copy Markdown
Contributor

Support allowed_hosts when running via docker compose, to avoid this error on development servers:

image

Related PR — Documentation update: SpeciesFileGroup/taxonworks_doc#108

neolefty and others added 5 commits June 27, 2025 10:24
Allow developers to specify custom hostnames in their local
application_settings.yml without adding them to version control.
This enables per-developer server configuration while keeping
the codebase clean.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Use Settings.get_config_hash to access custom configuration values
since the Settings module doesn't dynamically create methods for
arbitrary keys.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Allow the Settings module to accept allowed_hosts configuration
without throwing a validation error.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
The allowed_hosts configuration needs to run after
Settings.load_from_settings_file so the settings are available.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@LocoDelAssembly

Copy link
Copy Markdown
Contributor

This would actually allow to apply on ANY environment, not just development? It ADDS more hosts rather than providing the list of allowed hosts?

Not sure what the interaction of this and production deployments would be, looks that config.hosts is undefined and fully managed by nginx/phusion passenger:

root@tw-sandcastle-7bc8d6956b-wjkbh:/app# RAILS_ENV=production bundle exec rails c
Loading production environment (Rails 7.2.2.1)
3.4.2 :001 > TaxonWorks::Application.configure { puts config.hosts }
 => nil 

@neolefty

Copy link
Copy Markdown
Contributor Author

This would actually allow to apply on ANY environment, not just development? It ADDS more hosts rather than providing the list of allowed hosts?

Not sure what the interaction of this and production deployments would be, looks that config.hosts is undefined and fully managed by nginx/phusion passenger:

root@tw-sandcastle-7bc8d6956b-wjkbh:/app# RAILS_ENV=production bundle exec rails c
Loading production environment (Rails 7.2.2.1)
3.4.2 :001 > TaxonWorks::Application.configure { puts config.hosts }
 => nil 

I only tested this under docker compose — that's what I meant by "development servers". I assumed a production server would be running under kubernetes.

@LocoDelAssembly

LocoDelAssembly commented Jul 10, 2025

Copy link
Copy Markdown
Contributor

Note to self

Looks production env does not include the required middleware for above problem to occur:

 ✘ hernan@9900k  ~/Projects/taxonworks   development ±  RAILS_ENV=development rails middleware | grep -i host
use ActionDispatch::HostAuthorization
 hernan@9900k  ~/Projects/taxonworks   development ±  RAILS_ENV=production rails middleware | grep -i host
 ✘ hernan@9900k  ~/Projects/taxonworks   development ±  

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.

2 participants