Cannot update Elasticsearch URL in Advanced Search admin settings

Summary

On Advanced Search, im trying to connect to an internal ES cluster here. https://mydns.com:9210/. It doesnt work. I received a 500 back from Gitlab and from the log i see that it still tried to reach http://localhost:9200

Steps to reproduce

  1. Advanced Search / Set ElasticSearch URL to "https://mydns.com:9210/"
  2. Enable ElasticSearch Indexing checkbox.
  3. Save Changes
  4. 500
  5. Check the logs

What is the current bug behavior?

I receive en error 500 back from Gitlab when I press Save Changes.

What is the expected correct behavior?

Gitlab should create an empty index in the ES specified by URL settings.

Relevant logs and/or screenshots

Logs show always this:

{
  "method": "PATCH",
  "path": "/admin/application_settings/general",
  "format": "html",
  "controller": "Admin::ApplicationSettingsController",
  "action": "general",
  "status": 500,
  "time": "2020-12-28T15:35:20.968Z",
  "params": [
    {
      "key": "utf8",
      "value": "✓"
    },
    {
      "key": "_method",
      "value": "patch"
    },
    {
      "key": "authenticity_token",
      "value": "[FILTERED]"
    },
    {
      "key": "application_setting",
      "value": {
        "elasticsearch_indexing": "[FILTERED]",
        "elasticsearch_pause_indexing": "[FILTERED]",
        "elasticsearch_search": "[FILTERED]",
        "elasticsearch_url": "[FILTERED]",
        "elasticsearch_shards": "[FILTERED]",
        "elasticsearch_replicas": "[FILTERED]",
        "elasticsearch_indexed_file_size_limit_kb": "[FILTERED]",
        "elasticsearch_indexed_field_length_limit": "[FILTERED]",
        "elasticsearch_max_bulk_size_mb": "[FILTERED]",
        "elasticsearch_max_bulk_concurrency": "[FILTERED]",
        "elasticsearch_client_request_timeout": "[FILTERED]",
        "elasticsearch_limit_indexing": "[FILTERED]",
        "elasticsearch_namespace_ids": "[FILTERED]",
        "elasticsearch_project_ids": "[FILTERED]",
        "elasticsearch_analyzers_smartcn_enabled": "[FILTERED]",
        "elasticsearch_analyzers_kuromoji_enabled": "[FILTERED]",
        "elasticsearch_aws": "[FILTERED]",
        "elasticsearch_aws_region": "[FILTERED]",
        "elasticsearch_aws_access_key": "[FILTERED]",
        "elasticsearch_aws_secret_access_key": "[FILTERED]"
      }
    }
  ],
  "remote_ip": "10.0.0.144",
  "user_id": 159,
  "username": "DUPONT",
  "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36",
  "correlation_id": "01ETMZTNH9PQCB5K275ZWDVBVT",
  "meta.user": "DUPONT",
  "meta.caller_id": "Admin::ApplicationSettingsController#general",
  "meta.feature_category": "not_owned",
  "redis_calls": 2,
  "redis_duration_s": 0.001966,
  "redis_read_bytes": 386,
  "redis_write_bytes": 961,
  "redis_cache_calls": 1,
  "redis_cache_duration_s": 0.000274,
  "redis_cache_read_bytes": 202,
  "redis_cache_write_bytes": 82,
  "redis_shared_state_calls": 1,
  "redis_shared_state_duration_s": 0.001692,
  "redis_shared_state_read_bytes": 184,
  "redis_shared_state_write_bytes": 879,
  "elasticsearch_calls": 1,
  "elasticsearch_duration_s": 0.002621,
  "db_count": 10,
  "db_write_count": 1,
  "db_cached_count": 2,
  "cpu_s": 0.05,
  "exception.class": "Errno::ENETUNREACH",
  "exception.message": "Network is unreachable - Network is unreachable - connect(2) for \"localhost\" port 9200 (localhost:9200)",
  "exception.backtrace": [
    "lib/gitlab/instrumentation/elasticsearch_transport.rb:12:in `perform_request'",
    "ee/lib/gitlab/elastic/helper.rb:126:in `index_exists?'",
    "ee/app/services/ee/application_settings/update_service.rb:64:in `find_or_create_index'",
    "ee/app/services/ee/application_settings/update_service.rb:19:in `execute'",
    "app/controllers/admin/application_settings_controller.rb:261:in `perform_update'",
    "app/controllers/admin/application_settings_controller.rb:50:in `block (2 levels) in <class:ApplicationSettingsController>'",
    "ee/lib/gitlab/ip_address_state.rb:10:in `with'",
    "ee/app/controllers/ee/application_controller.rb:44:in `set_current_ip_address'",
    "app/controllers/application_controller.rb:494:in `set_current_admin'",
    "lib/gitlab/session.rb:11:in `with_session'",
    "app/controllers/application_controller.rb:485:in `set_session_storage'",
    "lib/gitlab/i18n.rb:73:in `with_locale'",
    "lib/gitlab/i18n.rb:79:in `with_user_locale'",
    "app/controllers/application_controller.rb:479:in `set_locale'",
    "lib/gitlab/error_tracking.rb:52:in `with_context'",
    "app/controllers/application_controller.rb:544:in `sentry_context'",
    "app/controllers/application_controller.rb:472:in `block in set_current_context'",
    "lib/gitlab/application_context.rb:54:in `block in use'",
    "lib/gitlab/application_context.rb:54:in `use'",
    "lib/gitlab/application_context.rb:21:in `with_context'",
    "app/controllers/application_controller.rb:464:in `set_current_context'",
    "lib/gitlab/request_profiler/middleware.rb:17:in `call'",
    "lib/gitlab/jira/middleware.rb:19:in `call'",
    "lib/gitlab/middleware/go.rb:20:in `call'",
    "lib/gitlab/etag_caching/middleware.rb:21:in `call'",
    "lib/gitlab/middleware/multipart.rb:234:in `call'",
    "lib/gitlab/middleware/read_only/controller.rb:50:in `call'",
    "lib/gitlab/middleware/read_only.rb:18:in `call'",
    "lib/gitlab/middleware/same_site_cookies.rb:27:in `call'",
    "lib/gitlab/middleware/handle_malformed_strings.rb:21:in `call'",
    "lib/gitlab/middleware/basic_health_check.rb:25:in `call'",
    "lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in `call'",
    "lib/gitlab/middleware/request_context.rb:23:in `call'",
    "config/initializers/fix_local_cache_middleware.rb:9:in `call'",
    "lib/gitlab/metrics/requests_rack_middleware.rb:76:in `call'",
    "lib/gitlab/middleware/release_env.rb:12:in `call'"
  ],
  "db_duration_s": 0.02914,
  "view_duration_s": 0.0,
  "duration_s": 0.08354
}

Why is always trying to reach localhost:9200 ?

Output of checks

Results of GitLab environment info

Im running docker Gitlab-EE 13.7.0.

Edited by Dylan Griffith