Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Mojolicious-Hypnotoad-Nginx - rendering images

by haukex (Archbishop)
on Apr 15, 2021 at 13:54 UTC ( [id://11131332]=note: print w/replies, xml ) Need Help??


in reply to Mojolicious-Hypnotoad-Nginx - rendering images

There is mention of "hooks" needed to correct for the workings of a Reverse Proxy, but after a long search one doesn't find a clear full example -- particularly for Nginx.

I operate Hypnotoad behind nginx, see Nginx in Mojolicious::Guides::Cookbook (in addition I do proxy_set_header X-Real-IP $remote_addr;, but that's optional). Plus, I had to set the proxy => 1 option in the Mojo::Server::Hypnotoad config, and set the MOJO_REVERSE_PROXY environment variable. (The latter may no longer be necessary, I'm not sure because I worked out this config a while ago and Mojolicious evolves quickly, but it also can't hurt to turn it on. Update: I checked and AFAICT, in Hypnotoad, proxy=>1 sets Mojo::Server's reverse_proxy, but for other servers like morbo, it's the MOJO_REVERSE_PROXY environment variable. That's why I set both.)

Note that for requests that shouldn't be buffered/proxied, like EventSource streams, you additionally need to set the X-Accel-Buffering header: $c->res->headers->add('X-Accel-Buffering','no'); (docs).

However, the issue you describe may have nothing to do with the setup - the first step when things don't load is to look at the browser's development tools and the sever logs, or even a Wireshark trace.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11131332]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-20 03:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found