creativecommons / sre-salt-prime

Site Reliability Engineering / DevOps SaltStack configuration files
MIT License
21 stars 9 forks source link

Add CORS policy to header in apache2 module #274

Closed amandayclee closed 7 months ago

amandayclee commented 7 months ago

Fixes

Description

Add CORS policy to header in apache2 module.

Technical details

Set header in states/apache2/files/index.conf.

Checklist

amandayclee commented 7 months ago

This will cause errors unless the headers module is also enabled (item 1 from #274)

Hey @TimidRobot, Thank you for getting back to me real fast!

Is this the correct place to add it for index.conf? https://github.com/creativecommons/sre-salt-prime/blob/38a81a4236d959700558753c58c2206b4b385e95/states/apache2/init.sls#L8

Something like

{% set MODS_ENABLE = salt["pillar.get"]("apache2:mods:enable", ["headers"]) -%}
Shafiya-Heena commented 7 months ago

Thank you for your contribution. Unfortunately, the proposed solution of setting a variable does not enable the Apache modules. For the configuration changes to take effect, additional Salt states are required that leverage this variable. We appreciate your understanding and look forward to further collaboration to refine the solution

Shafiya-Heena commented 7 months ago

Thank you @amandayclee for your contribution, which has brought us close to finalizing our solution. For the pillar data, the header entry needs to be left empty(to enable the header module), and the required changes are outlined below.

Could you please incorporate these adjustments into your pull request.This will enable us to move forward with merging it. We greatly appreciate your collaboration.

index b42fe7d..d1c590f 100644
--- pillars/3_HST/index/init.sls
+++ pillars/3_HST/index/init.sls

@@ -4,6 +4,10 @@ include:
   - mysql
   - php

+apache2:
+  mods:
+    enable:
+      - headers

 letsencrypt:
   post_hooks:
     restart_apache2.sh: /usr/sbin/service apache2 reload
Shafiya-Heena commented 7 months ago

Thank you!!

TimidRobot commented 6 months ago

deployed to production & staging Mon 01 Apr 2024 04:12:56 PM UTC (it may take 30 minutes for caches to expire)