<p>I have <a href="https://github.com/cloudflare/cfssl" rel="nofollow noreferrer">CFSSL</a> service running in kubernetes on port <code>8888</code>. I can access it API's from another pod directly referring <code>cfssl:8888</code>. I want to expose it via Nginx and I have Nginx running in separate pod with following config  </p>

<pre><code>upstream cfssl {
    server cfssl:8888;
}

server {
    listen         80 default_server;
    listen         [::]:80 default_server;
    server_name    localhost;

    location / {
        proxy_pass http://cfssl;
        proxy_set_header Host cfssl;
    }
}
</code></pre>

<p>But this Nginx config is not working, I can access <code>cfssl:8888</code> wethin Nginx pod, but when I do <code>curl localhost:80</code> </p>

<pre><code>curl: (7) Failed to connect to localhost port 80: Connection refused
</code></pre>

<p>What is wrong in this setup ?</p>

roy
<p>Inside location block you have not mention port </p>

<pre><code>location / {
        proxy_pass http://cfssl;
</code></pre>

<p>it should be something like</p>

<pre><code>server {
    listen         80 default_server;
    listen         [::]:80 default_server;
    server_name    localhost;

    location / {
        proxy_pass http://cfssl:8888;
        proxy_set_header Host cfssl;
    }
</code></pre>
