I managed to get my Drupal 9 site up and going (thanks!), but when attempting to log in, I'm getting a 502 bad gateway error.

I'm tailing the nginx access and error logs in the stack, but nothing is appearing in the error logs.

I thought it was maybe a PHP memory issue (saw that a few times), so followed the instructions for advanced config, bumped up the memory and confirmed it was bumped after restarting by doing a php --info | grep memory_limit pointing to the stack's PHP.

I'm only seeing the 502 on authenticated sessions as a Drupal user. Any ideas of where else I should be looking to figure out what is causing the error?

So I figured out the error logs are in .indigo/stacks/system-stack/nginx_reverse_proxy/, but I'm trying to fix my nginx error of Nginx upstream sent too big header while reading response header from upstream.

I assume I need to customize the nginx configuration and trying to figure out how to do that following the advanced config tutorial.

If I manually copy the .indigo/stacks/system-stack/nginx_reverse_proxy/conf/sites-enabled/my-site-conf. to the stack location with the nginx_B231 name, it doesn't build and says it cant find the host. I assume that is because the .conf file I copied has the specific port in it and that port changes when you restart the stack. How else can I modify the buffer values as recommended at https://stackoverflow.com/questions/25762111/how-to-fix-upstream-sent-too-big-header-while-reading-response-header-from-upstr to fix the issue?

    Just one thing to clarify: in Indigo the reverse proxy is provided by a "System Stack nginx" service, so in your setup there will be two Nginx instances. It looks like you've been looking at the logs for the System Stack's nginx; be sure to check the logs for your stack's nginx as well. I plan to eventually provide easier access to the service logs, but for now you'll have to right-click the nginx service in your stack, and choose "Show Compiled in Finder..." from where you can find the relevant logs (and conf) directory.

    A few ideas...

    Have you checked your PHP logs? Again, right-click your PHP service — you'll find its logs in the Finder there.

    It might be worth trying to access your site directly, bypassing the reverse proxy, to confirm the problem is there; do this by appening its port, which you can find in the site configuration. eg for the below config, you'd visit https://drupal9.test:50004.

    As you can see, I just installed D9 inside Indigo hoping to replicate the issue you've raised but it installed and ran perfectly; I'm guessing this issue is caused by one or more contrib modules, and the basic Umami Foods demo site is too lightweight. If you think you might know how I could replicate it, I'd be intrigued. However I am hopeful we can get your site up and running without having to replicate the issue myself.

    fmitchell If I manually copy the .indigo/stacks/system-stack/nginx_reverse_proxy/conf/sites-enabled/my-site-conf. to the stack location with the nginx_B231 name, it doesn't build and says it cant find the host.

    Aha, yes, with the above you'll be overwriting your stack's nginx config with the system stack's reverse-proxy nginx config. The config for your nginx will be at something like ~/.indigo/stacks/STACKID/nginx_B231/conf

    The config suggested in that Stack Overflow solution (ie as per below) is in fact already in the standard Indigo nginx config for a site. Perhaps it's worth trying it outside the location block?

    fastcgi_buffers 16 16k;
    fastcgi_buffer_size 32k;

    I bypassed the reverse proxy and the authenticated pages now work. I did see that those values are in there, but it didn't seem to resolve the 502 error.

    I definitely was tailing all logs (PHP, nginx access, nginx error) and finally saw the error only when i was tailing the nginx reverse proxy (system stack) error log. Everything else returned blank.

    It is not a blank Drupal install, but it has a very big (4GB) database. Since the authenticated pages do load using the direct port to the nginx web server, what other ways can I modify the configuration of the reverse proxy since that seems to be the issue?

    Do I need to create a custom nginx.conf inside the package contents of the system stack stack.indigostack ?

    Specifically, I was going to try and modify the proxy_buffers values via https://ma.ttias.be/nginx-proxy-upstream-sent-big-header-reading-response-header-upstream/

    Hmm, this one is tricky! If you take the error at face value, do you think your Drupal site actually is setting a header which is too large? In the past I've seen a Drupal module (probably one of mine lol, I forget) which was appending a long string to one of its cookies on each page load. So rather than replacing the cookie with the new value it was appended and so the cookie got larger and larger on each page load until it was larger than allowed.

    You can actually override the config for the system stack services, in a similar manner to the stack's services. You just prefix those services with system/ ie inside your .indigostack bundle, you need a file structure like so:

    system/nginx_reverse_proxy/conf/sites-enabled/custom.conf

    ...or you can override an existing conf using that file structure as a guide.

    Thanks for your persistence; I'm really hoping we can get to the bottom of this.

    Powered by: FreeFlarum.
    (remove this footer)