question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

nginx in rc.12 no more proxy_pass infinity loading

See original GitHub issue

Environment


  • Operating System: Linux
  • Node Version: v16.13.0
  • Nuxt Version: 3.0.0-rc.12
  • Nitro Version: 0.6.0
  • Package Manager: npm@8.15.1
  • Builder: vite
  • User Config: modules, vue, runtimeConfig, css, buildModules, build
  • Runtime Modules: @nuxtjs/tailwindcss@5.3.5
  • Build Modules: @pinia/nuxt@0.4.3

Reproduction

server
{
    listen 80;
    listen [::]:80;
    server_name site.dev www.site.dev;

    location /
    {
        proxy_pass http://127.0.0.1:3001;
        include /etc/nginx/proxy_params;
    }
}

params


proxy_buffers 16 32k;
        proxy_buffer_size 64k;
        proxy_busy_buffers_size 128k;
        proxy_cache_bypass $http_pragma $http_authorization;
        proxy_connect_timeout 59s;
        proxy_hide_header X-Powered-By;
        proxy_http_version 1.1;
        proxy_ignore_headers Cache-Control Expires;
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504 http_404;
        proxy_no_cache $http_pragma $http_authorization;
        proxy_pass_header Set-Cookie;
        proxy_read_timeout 600;
        proxy_redirect off;
        proxy_send_timeout 600;
        proxy_temp_file_write_size 64k;
        proxy_set_header Accept-Encoding '';
        proxy_set_header Cookie $http_cookie;
        proxy_set_header Host $host;
        proxy_set_header Proxy '';
        proxy_set_header Referer $http_referer;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Original-Request $request_uri;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;

Describe the bug

infinity loading.

Additional context

No response

Logs

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:5
  • Comments:21 (5 by maintainers)

github_iconTop GitHub Comments

32reactions
levidavidmurraycommented, Oct 19, 2022

These proxy_params seem to have fixed the infinite loading, but I’m seeing response times of up to 5 seconds in dev environment… (prod build)

This seems to have started with this commit (https://github.com/nuxt/framework/commit/5a2616cfee4c3ca2838785536c43d6dcdb780ee8) that added support for early hint rendering (status code 103).

Note the header differences between a direct connection to the nitro server versus an nginx proxy_pass

# =========== direct nitro connection =========== 
levi@Levi-PC:~/Code/gh/nuxt-rc-13-app$ curl -s -D - -o /dev/null http://localhost:3000
HTTP/1.1 103 Early Hints
Link: </_nuxt/entry.41705590.js>; rel="modulepreload"; as="script"; crossorigin, </_nuxt/error-component.3ac342b2.js>; rel="prefetch"; as="script"; crossorigin

HTTP/1.1 200 OK
Content-Type: text/html;charset=UTF-8
X-Powered-By: Nuxt
Server-Timing: -;dur=0;desc="Generate"
Date: Wed, 19 Oct 2022 09:21:06 GMT
Connection: keep-alive
Keep-Alive: timeout=5
Content-Length: 702

# =========== nginx proxy_pass =========== 
levi@Levi-PC:~/Code/gh/nuxt-rc-13-app$ curl -s -D - -o /dev/null http://localhost
HTTP/1.1 103 Early Hints
Server: nginx/1.18.0 (Ubuntu)
Date: Wed, 19 Oct 2022 09:20:57 GMT
Connection: keep-alive
Link: </_nuxt/entry.41705590.js>; rel="modulepreload"; as="script"; crossorigin, </_nuxt/error-component.3ac342b2.js>; rel="prefetch"; as="script"; crossorigin

HTTP/1.1 200 OK
Content-Type: text/html;charset=UTF-8
X-Powered-By: Nuxt
Server-Timing: -;dur=0;desc="Generate"
Date: Wed, 19 Oct 2022 09:20:57 GMT
Connection: close

^C

I’m sure there’s an ideal proxy_pass config to support this, but I frankly just don’t have the patience for it as this feature isn’t important to me. I just ended up disabling experimental.writeEarlyHints in nuxt.config.ts:

export default defineNuxtConfig({
  ...
  experimental: {
    writeEarlyHints: false,
  },
  ...
})
8reactions
misaoncommented, Oct 21, 2022

@danielroe It might be a good point to add recommended settings for Nginx (proxy) to the documentation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Avoiding the Top 10 NGINX Configuration Mistakes
We help you avoid the 10 most common NGINX configuration errors, explaining the problems caused by each and how to fix them.
Read more >
Top 25 Nginx Web Server Best Security Practices - nixCraft
This pages shows how to secure Nginx web server including various hardening approaches and best security on Linux or Unix-like system.
Read more >
How to set up an nginx reverse proxy with SSL termination in ...
This guide is going to assume that the reverse proxy will be responsible for maintaining the certificates for all of the servers that...
Read more >
unraid write speed - Ozzys Barber Club
Unraid uses parity drives, and does not stripe the data. Im using HP Proliant microserver with AMD Turion 2 Neo Dual core and...
Read more >
NginX Proxy Pass Infinite Loop - Stack Overflow
But if I add suffix in location directive, it is fine. location /tracker { proxy_pass http://localhost:8080/tracker; // not infinite loop } ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found