Ryan H
Ryan H

Reputation: 2953

Nuxt JS reverse proxy load balancer on Laravel Forge

I'm trying to set up a Laravel Forge load balancer for my Nuxt JS front-end and Laravel back-end application. I've provisioned three servers, two of them host both the API and GUI on each, and the third is the load balancer.

The load balancer has the two domains, one for the front-end, one for the back-end.

Here's the Nginx config for the load balancer for the front-end domnain:

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/lespro-forge.rdrt.org/before/*;

# FORGE CONFIG (DO NOT REMOVE!)
include upstreams/lespro-forge.rdrt.org;

server {
    http2 on;
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name lespro-forge.rdrt.org;
    server_tokens off;

    # FORGE SSL (DO NOT REMOVE!)
    ssl_certificate /etc/nginx/ssl/lespro-forge.rdrt.org/2540239/server.crt;
    ssl_certificate_key /etc/nginx/ssl/lespro-forge.rdrt.org/2540239/server.key;

    ssl_protocols TLSv1.2 TLSv1.3;
    charset utf-8;

    access_log off;
    error_log  /var/log/nginx/lespro-forge.rdrt.org-error.log error;

    # FORGE CONFIG (DO NOT REMOVE!)
    include forge-conf/lespro-forge.rdrt.org/server/*;

    # Handle all other requests
    location / {
        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;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_pass http://2613931_app/;
        proxy_redirect off;

        # Handle Web Socket Connections
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/lespro-forge.rdrt.org/after/*;

CSS, JS and all other front-end assets seem to throw errors like:

Refused to execute script from 'https://my-domain/_nuxt/static/1739206687/state.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

How can I resolve this?

Upvotes: -1

Views: 36

Answers (0)

Related Questions