Skip to content

Example Nginx reverse proxy? #98

@YouveGotMeowxy

Description

@YouveGotMeowxy

I'm using SWAG to reverse proxy DB and get a 500 error after I login to the newer v4.

Do you have a working example of a Nginx RP that works with version 4?

I'm currently using the .conf that comes with SWAG but it stopped working with v4 (worked with v3), and the location block in it looks like this:

    location / {
        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
        set $upstream_app discount-bandit;
        set $upstream_port 80;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;
    }

I tried asking chatGPT and it told me:

Image Image

As a quick test added the OCTANE_HTTPS=true to my env vars in compose, and I tried editing app.php like it said, to this:

<?php

use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;

return Application::configure(basePath: dirname(__DIR__))
    ->withRouting(
        web: __DIR__.'/../routes/web.php',
        api: __DIR__.'/../routes/api.php',
        commands: __DIR__.'/../routes/console.php',
        health: '/up',
    )
    ->withMiddleware(function (Middleware $middleware) {
        $middleware->trustProxies(
        at: '*',
        headers: Request::HEADER_X_FORWARDED_FOR
               | Request::HEADER_X_FORWARDED_HOST
               | Request::HEADER_X_FORWARDED_PORT
               | Request::HEADER_X_FORWARDED_PROTO);
    })
    ->withExceptions(function (Exceptions $exceptions) {
//        $exceptions->render(function (Exception $e) {
//            if ($e->is_notifiable) {
//                dd("custom filament notification");
//            }
//        });
    })
    ->create();

and then mounting it, but I think in the container startup process it's not loading properly, and it doesn't work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions