Skip to content

[ENHANCEMENT] Dynamic drupal trusted hosts setting.#158

Closed
cafuego wants to merge 1 commit intoIslandora-Devops:devfrom
cafuego:patch-1
Closed

[ENHANCEMENT] Dynamic drupal trusted hosts setting.#158
cafuego wants to merge 1 commit intoIslandora-Devops:devfrom
cafuego:patch-1

Conversation

@cafuego
Copy link
Copy Markdown

@cafuego cafuego commented Feb 6, 2020

What does this Pull Request do?

This change allows direct access to Drupal via the virtual machine IP (or hostname) without a change to the Drupal $settings['trusted_host_patterns'] variable.

What's new?

Allows easier access to Islandora on the VM. However, this is not necessarily a safe change for a production installation.

How should this be tested?

Access Islandora via a non-localhost address after VM creation.

Interested parties

Tag (@ mention) interested parties or, if unsure, @Islandora-Devops/committers

This change allows direct access to Drupal via the VM IP (or name) without a change to the Drupal `$settings['trusted_host_patterns']` variable.
drupal_trusted_hosts:
- ^localhost$
- "{{ hostvars[groups['webserver'][0]].ansible_host }}"
- "^' . preg_quote($_SERVER['SERVER_NAME']) . '$"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems like a PHP command...does that work within the ansible framework which is (I think) Ruby?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it works because settings.php is a php file? I haven't tried it yet to find out.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ohhhhhhh 🤦‍♂

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes, running ansible with this entry added to the variables will add '^' . preg_quote($_SERVER['SERVER_NAME']) . '$' to the trusted host patterns. That means any name (or IP) you use to access the Islandora instance in the VM will automagically be trusted, so you don't need to explicitly add it.

@github-actions
Copy link
Copy Markdown

This PR is being marked as stale from inactivity and will be automatically closed in 90 days unless further action is taken. If this PR is still relevant please comment. Please also consider attending the weekly Tech Call to discuss the PR

@github-actions github-actions Bot added the Stale label Jun 11, 2025
@github-actions github-actions Bot closed this Jun 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants