Enable Drupal AI Module Functionality for Environments Behind a Proxy

Created on 18 October 2024, about 1 month ago

Problem/Motivation

The Drupal AI module currently does not support environments where requests must be routed through an HTTP/HTTPS proxy. Many organizations use proxies to secure and manage external communications, especially in development and corporate environments. Without proper proxy support, external API calls made by the module may fail, rendering the module unusable in these environments.

Steps to reproduce

1. Set up Drupal in a local or corporate environment where internet access is restricted and routed through an HTTP/HTTPS proxy.
2. Install and enable the Drupal AI module.
3. Attempt to setup OpenAI Authentication after adding OpenAI key .
4. Observe that the setup fails because the test request is not routed through the configured proxy.

Proposed resolution

- Update the Drupal AI module to support proxy configuration in `settings.php`.
- Leverage Drupal's `$settings['http_client_config']['proxy']` for both HTTP and HTTPS proxies.
- Include the ability to configure proxy authentication (if needed).
- Allow exceptions for certain local addresses (e.g., 127.0.0.1 or localhost) to bypass the proxy.

Remaining tasks

- Implement proxy support in the Drupal AI module's external requests handling.
- Write test cases for environments behind proxies.
- Update documentation to guide users on configuring proxy settings for the module.

User interface changes

No direct user interface changes are required for proxy support, but a settings option could be added to configure proxy settings via the admin interface (optional).

API changes

No API changes are required, but proxy support should integrate with the existing HTTP client configuration in Drupal.

Data model changes

No changes to the data model are required.

Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇨🇭Switzerland olegiv

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024