<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>header &#8211; SMsoft &#8211; informatica e dintorni</title>
	<atom:link href="https://blog.smsoft.it/tag/header/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.smsoft.it</link>
	<description>consigli settimanali su MacOS, GNU/Linux ed Open Source</description>
	<lastBuildDate>Thu, 28 Aug 2025 20:29:48 +0000</lastBuildDate>
	<language>it-IT</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=99047</generator>
	<item>
		<title>Apache/PHP e l&#8217;header Content-Length sparito</title>
		<link>https://blog.smsoft.it/2025/03/25/apache-php-e-lheader-content-length-sparito/</link>
					<comments>https://blog.smsoft.it/2025/03/25/apache-php-e-lheader-content-length-sparito/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 25 Mar 2025 09:30:00 +0000</pubDate>
				<category><![CDATA[Html e PHP]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[Content-Length]]></category>
		<category><![CDATA[header]]></category>
		<category><![CDATA[php]]></category>
		<guid isPermaLink="false">https://blog.smsoft.it/?p=6684</guid>

					<description><![CDATA[Facendo alcuni test su degli script PHP è risultato che l&#8217;header Content-Length, seppur impostato, non veniva restituito da Apache. Dopo alcune ricerche è emerso che dalla versione 2.4.59, per gli script CGI-like (come PHP) non possono più restituire l&#8217;header Content-Length per motivi di sicurezza (rif CVE-2024-24795). Per ambienti sicuri è possibile ripristinare il precedente funzionamento ... <a title="Apache/PHP e l&#8217;header Content-Length sparito" class="read-more" href="https://blog.smsoft.it/2025/03/25/apache-php-e-lheader-content-length-sparito/" aria-label="Per saperne di più su Apache/PHP e l&#8217;header Content-Length sparito">Leggi tutto</a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Facendo alcuni test su degli script <strong>PHP</strong> è risultato che l&#8217;header <strong>Content-Length</strong>, seppur impostato, non veniva restituito da <strong>Apache</strong>.</p>



<p class="wp-block-paragraph">Dopo alcune ricerche è emerso che dalla versione 2.4.59, per gli script CGI-like (come PHP) non possono più restituire l&#8217;header <strong>Content-Length</strong> per motivi di sicurezza (rif <a href="https://www.cve.org/CVERecord?id=CVE-2024-24795" target="_blank" rel="noreferrer noopener">CVE-2024-24795</a>).</p>



<p class="wp-block-paragraph">Per ambienti sicuri è possibile ripristinare il precedente funzionamento tramite una nuova direttiva di apache chiamata <a href="https://httpd.apache.org/docs/current/env.html#cgilike" target="_blank" rel="noreferrer noopener">ap_trust_cgilike_cl</a>.</p>



<p class="wp-block-paragraph">Per impostarla, creiamo un file chiamato <strong>/etc/apache2/conf-available/fix-cgi.conf</strong> con all&#8217;interno:</p>



<pre class="wp-block-code"><code>SetEnv ap_trust_cgilike_cl 1</code></pre>



<p class="wp-block-paragraph">e poi abilitiamolo con:</p>



<pre class="wp-block-code"><code>a2enconf fix-cgi
systemctl reload apache2</code></pre>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">enjoy!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.smsoft.it/2025/03/25/apache-php-e-lheader-content-length-sparito/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>cUrl (host header): fare una chiamata passando l&#8217;hostname e l&#8217;ip</title>
		<link>https://blog.smsoft.it/2014/05/20/curl-fare-una-chiamata-passando-lhost-e-lip/</link>
					<comments>https://blog.smsoft.it/2014/05/20/curl-fare-una-chiamata-passando-lhost-e-lip/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 20 May 2014 09:30:49 +0000</pubDate>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[bilanciatore]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[header]]></category>
		<category><![CDATA[host]]></category>
		<category><![CDATA[load balancer]]></category>
		<category><![CDATA[virtualhost]]></category>
		<guid isPermaLink="false">http://blog.smsoft.it/?p=2765</guid>

					<description><![CDATA[Il titolo di oggi è un po&#8217; emblematico, ma altrettanto emblematico potrebbe essere il contenuto del post, a meno che non siate in questo specifico caso: &#8220;Vorrei fare una richiesta ad un server web multidominio che non ha ancora il DNS puntato per un particolare dominio&#8221;. In questo caso, cosa succede? Purtroppo, non essendoci il ... <a title="cUrl (host header): fare una chiamata passando l&#8217;hostname e l&#8217;ip" class="read-more" href="https://blog.smsoft.it/2014/05/20/curl-fare-una-chiamata-passando-lhost-e-lip/" aria-label="Per saperne di più su cUrl (host header): fare una chiamata passando l&#8217;hostname e l&#8217;ip">Leggi tutto</a>]]></description>
										<content:encoded><![CDATA[<p>Il titolo di oggi è un po&#8217; emblematico, ma altrettanto emblematico potrebbe essere il contenuto del post, a meno che non siate in questo specifico caso: &#8220;Vorrei fare una richiesta ad un server web multidominio che non ha ancora il DNS puntato per un particolare dominio&#8221;.</p>
<p>In questo caso, cosa succede? <strong>Purtroppo, non essendoci il puntamento DNS, non posso richiamare il dominio direttamente con fqdn.nomedominio.ext, perché il server web non capirebbe con quale virtualhost rispondere</strong>. Potrei impostare il puntamento DNS nel file hosts del mio PC, ma nel caso sia necessario creare uno script PHP su un terzo spazio web e quindi non avere la possibilità di &#8220;impostargli&#8221; un DNS farlocco?</p>
<p><strong>cUrl</strong> ci viene in aiuto, con le decine di funzionalità che ha. E&#8217; infatti possibile passare un parametro all&#8217;<strong>header</strong> della richiesta, indicando quale virtualhost richiamare.</p>
<p>Facciamo un esempio pratico. Il virtualhost risponde al nome <strong>fqdn.nomedominio.ext</strong> (che però ancora non è mappato sul server DNS) e l&#8217;IP del server web è <strong>10.10.10.10</strong>. In questo caso la richiesta da fare è:</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">curl -v --header 'Host: fqdn.nomedominio.ext' 10.10.10.10</pre><p></p>
<p>Così facendo, risponderà il virtualhost <strong>fqdn.nomedominio.ext</strong> sul server con IP <strong>10.10.10.10</strong>.</p>
<p>Nel caso volessi fare la stessa cosa in PHP, basterebbe uno script del genere:</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$ch = curl_init();
curl_setopt($ch,CURLOPT_HTTPHEADER,array('Host: fqdn.nomedominio.ext'));
curl_setopt($ch, CURLOPT_URL, '10.10.10.10');
$content = curl_exec($ch);
curl_close ( $ch );
print_r($content);</pre><p></p>
<p>Questa cosa è molto utile quando si ha a che fare con un bilanciatore (load balancer).</p>
<p>enjoy</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.smsoft.it/2014/05/20/curl-fare-una-chiamata-passando-lhost-e-lip/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
