<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://www.baszerr.eu/lib/exe/css.php?s=feed" type="text/css"?>
<rss version="2.0">
    <channel xmlns:g="http://base.google.com/ns/1.0">
        <title>BaSzErr - blog:2022:06:04</title>
        <description></description>
        <link>https://www.baszerr.eu/</link>
        <lastBuildDate>Wed, 06 May 2026 08:51:52 +0000</lastBuildDate>
        <generator>FeedCreator 1.8</generator>
        <image>
            <url>https://www.baszerr.eu/lib/exe/fetch.php?media=wiki:dokuwiki.svg</url>
            <title>BaSzErr</title>
            <link>https://www.baszerr.eu/</link>
        </image>
        <item>
            <title>2022-06-04_-_bash_and_raii_-_continued</title>
            <link>https://www.baszerr.eu/doku.php?id=blog:2022:06:04:2022-06-04_-_bash_and_raii_-_continued</link>
            <description>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;bash_and_raii_-_continued&quot;&gt;2022-06-04 - bash and RAII - continued&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
couple days ago i wrote about &lt;a href=&quot;https://www.baszerr.eu/doku.php?id=blog:2022:05:29:2022-05-29_-_bash_and_raii&quot; class=&quot;wikilink1&quot; title=&quot;blog:2022:05:29:2022-05-29_-_bash_and_raii&quot; data-wiki-id=&quot;blog:2022:05:29:2022-05-29_-_bash_and_raii&quot;&gt;RAII in bash&lt;/a&gt;. i forgot to mention 1 more thing there. when cleanup procedure is more complicated than simple &lt;code&gt;rm -rf foobar&lt;/code&gt; it&amp;#039;s worth to make it a separate function:
&lt;/p&gt;
&lt;pre class=&quot;code bash&quot;&gt;&lt;span class=&quot;co0&quot;&gt;# ...&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;function&lt;/span&gt; cleanup
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
  &lt;span class=&quot;kw2&quot;&gt;rm&lt;/span&gt; &lt;span class=&quot;re5&quot;&gt;-rf&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;&lt;span class=&quot;es2&quot;&gt;$VAR_TO_SANITIZE&lt;/span&gt;&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;kw2&quot;&gt;rm&lt;/span&gt; &lt;span class=&quot;re5&quot;&gt;-fv&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;/&lt;/span&gt;path&lt;span class=&quot;sy0&quot;&gt;/&lt;/span&gt;to&lt;span class=&quot;sy0&quot;&gt;/&lt;/span&gt;lock
  &lt;span class=&quot;kw2&quot;&gt;umount&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;/&lt;/span&gt;media&lt;span class=&quot;sy0&quot;&gt;/&lt;/span&gt;foobar
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span class=&quot;kw3&quot;&gt;trap&lt;/span&gt; cleanup EXIT
&lt;span class=&quot;co0&quot;&gt;# ...&lt;/span&gt;&lt;/pre&gt;

&lt;/div&gt;
</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Sat, 04 Jun 2022 20:20:51 +0000</pubDate>
        </item>
        <item>
            <title>2022-06-04_-_caching_proxy_in_nginx</title>
            <link>https://www.baszerr.eu/doku.php?id=blog:2022:06:04:2022-06-04_-_caching_proxy_in_nginx</link>
            <description>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;caching_proxy_in_nginx&quot;&gt;2022-06-04 - caching proxy in nginx&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
in one of the previous projects we had an issue on CI. &lt;abbr title=&quot;Too long; didn&amp;#039;t read&quot;&gt;TL;DR&lt;/abbr&gt; – we needed a cache, to minimize network traffic between different locations. case was simple: there were build artifacts, stored on site A and these were needed &lt;code&gt;N&lt;/code&gt; times on site B. since the files (once published) never changed, it was a simple matter of keeping a copy on site B, when it was 1st downloaded from site A.
&lt;/p&gt;

&lt;p&gt;
after some digging it turned out that &lt;a href=&quot;https://en.wikipedia.org/wiki/nginx&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/nginx&quot;&gt;nginx&lt;/a&gt; has a ready-to-go solution for exactly that! this is how an example configuration (&lt;code&gt;nginx.conf&lt;/code&gt;) looks like:
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 1024;
    # multi_accept on;
}


http {
    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    client_max_body_size 2048M;
    gzip off;

    server {
        listen 80 default_server;
        listen [::]:80 default_server;
        proxy_cookie_path / &amp;quot;/; HttpOnly; Secure&amp;quot;;
        server_name _;
        return 301 https://$host$request_uri;
    }

    proxy_cache_path  /var/cache/nginx/ levels=1:2 keys_zone=STATIC:10m inactive=15d max_size=1800g;
    server {
        listen 443 ssl default_server;
        listen [::]:443 ssl default_server;
        proxy_cookie_path / &amp;quot;/; HttpOnly; Secure&amp;quot;;
        server_name _;

        ssl_protocols TLSv1.2 TLSv1.3;
        ssl_certificate     /path/to/cert.pem;
        ssl_certificate_key /path/to/key.pem;

        location / {
            proxy_pass             https://actual.server.to.offload;
            proxy_cache_methods    GET HEAD;
            proxy_set_header       Host $host;
            proxy_buffering        on;
            proxy_cache            STATIC;
            proxy_cache_valid      200  10d;
            proxy_cache_use_stale  error timeout invalid_header updating
                                   http_500 http_502 http_503 http_504;
        }
    }
}&lt;/pre&gt;

&lt;p&gt;
this coveres: caching, cache lifetime management, HTTPS and HTTP to HTTPS redirection. all in 49 lines of config, including formatting. :D once deployed, there were no further issues observed. XXI century magic! ;)
&lt;/p&gt;

&lt;/div&gt;
</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Sat, 04 Jun 2022 20:29:46 +0000</pubDate>
        </item>
        <item>
            <title>2022-06-04_-_protecting_private_e-mail</title>
            <link>https://www.baszerr.eu/doku.php?id=blog:2022:06:04:2022-06-04_-_protecting_private_e-mail</link>
            <description>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;protecting_private_e-mail&quot;&gt;2022-06-04 - protecting private e-mail&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
if you have e-mail service, attached you your own domain, there are 3 must-haves to implement:
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;https://en.wikipedia.org/wiki/DMARC&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/DMARC&quot;&gt;DMARC&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;https://en.wikipedia.org/wiki/Sender_Policy_Framework&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/Sender_Policy_Framework&quot;&gt;SPF&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;https://en.wikipedia.org/wiki/DomainKeys_Identified_Mail&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/DomainKeys_Identified_Mail&quot;&gt;DKIM&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Sat, 04 Jun 2022 20:32:38 +0000</pubDate>
        </item>
    </channel>
</rss>
