<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="320884" data-post-id="320884">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Sanjibukai" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Sanjibukai
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Hi..<br>
Thanks for the reply..<br>
Does it mean that the requests for static files (e.g. under /priv) are no longer hitting the Phoenix server (here bandit)?<br>
Are you setting this config on Phoenix side or Nginx side? I guess it’s on Nginx.. Then the config for static assets on Phoenix becomes somehow useless, right?<br>
For reverse proxy and SSL I was using traefik but I also want to add caching and static assets serving..<br>
So I guess I’ll also switch to Nginx..<br>
Do you think you can share your nginx file (or just the main parts)?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="320884" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/bandit-server-for-phoenix-is-next-level-check-it-out/57284/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-320884" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="320884"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #16"></div>
  </section>
</div>
    <div class="postbit" id="327334" data-post-id="327334">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="conradwt" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/conradwt/120/19105_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  conradwt
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Hi, I’m sorry about not replying sooner.  Anyway, the static assets will be served by Nginx.  The Nginx configurations will be set within Nginx.  Here are some of the main parts to consider:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir"># Redirect HTTP to HTTPS
server {
    listen 80;
    server_name your_domain.com;
    return 301 https://$host$request_uri;
}

# HTTPS server block
server {
    listen 443 ssl;
    server_name your_domain.com;

    # SSL certificate and key
    ssl_certificate /etc/letsencrypt/live/your_domain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/your_domain.com/privkey.pem;

    # SSL settings
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_prefer_server_ciphers on;
    ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';

    # Root directory for your Phoenix application's static assets
    root /path/to/your/phoenix/app/priv/static;

    # Proxy requests to Phoenix application
    location / {
        proxy_pass http://127.0.0.1:4000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    # WebSocket support for /live endpoint
    location /live {
        proxy_pass http://127.0.0.1:4000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    # Static file caching
    location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
        expires max;
        add_header Cache-Control "public";
    }
}
</code></pre>
<p>The ciphers are a moving target but one can use the following site to assess your overall SSL webserver config:</p>
<aside class="onebox allowlistedgeneric" data-onebox-src="https://www.ssllabs.com/ssltest">
  <header class="source">

      <a href="https://www.ssllabs.com/ssltest" target="_blank" rel="noopener nofollow ugc">ssllabs.com</a>
  </header>

  <article class="onebox-body">
    

<h3><a href="https://www.ssllabs.com/ssltest" target="_blank" rel="noopener nofollow ugc">SSL Server Test (Powered by Qualys SSL Labs)</a></h3>

  <p>A comprehensive free SSL test for your public web servers.</p>


  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>
 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="327334" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/bandit-server-for-phoenix-is-next-level-check-it-out/57284/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-327334" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="327334"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #17"></div>
  </section>
</div>
    <div class="postbit" id="338969" data-post-id="338969">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="julismz" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/julismz/120/28368_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  julismz
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>What’s the point in separate the sockets from the rest of the request? Why one can’t add socket support to / directly, has it some disadvantage?</p>
<p>By the way, did you ever try it against a K8s cluster? Didn’t face any issues with stickies sessions?</p>
<p>On the other hand, is it a mistake to delegate to cloudflare the SSL part and have one less problem keeping in mind to renew certs, creates it, config, etc? I noticed that, in general, people prefer to have their own certs and 443 port…</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="338969" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/bandit-server-for-phoenix-is-next-level-check-it-out/57284/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-338969" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="338969"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>