Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

499
Views
Nuxt.js app behind nginx reverse-proxy loading multiple pages at once

I've a nuxt.js app behind nginx reverse proxy. The nginx conf file looks like this:

  server {
    listen 80;
    # Match *.lvh.me
    server_name  ~^(?<user>.+)\.lvh\.me$;

    location / {
      proxy_pass http://localhost:8080/sites/$user$uri$is_args$args;
    }

    location ~* \.(?:js|css|jpg|jpeg|gif|png|ico|cur|svg)$ {
      proxy_pass http://localhost:8080;
    }

  }

As you can see I'm mapping all my site subdomains to a specific path on my site and it is working fine. I'm also mapping all assets to be loaded from the root (because otherwise it throws a 404 error).

The only issue I'm facing is the whenever I visit a subdomain e.g subdomain.lvh.me it loads two pages on top of each other, the original page from subdomain root (which is expected) but also the page from the main domain root i.e. lvh.me (which is not expected).

Can you please checkout my conf file to see if I'm doing anything wrong here?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

So I've encountered this issue and what I did to fix it was to not rely on Nginx's root nor proxy_pass. Instead, I used a location block with an alias and a try_files inside like so:

location ^~ / {
        alias /path/to/dist;
        try_files $uri $uri/ /index.html = 404;
}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!