Reverse Proxy, Nginx, and static files

Hello all,

If we use a reverse proxy (like Nginx) and Standalone instances,
is it possible to let the Nginx server serve static files (images …) instead of Standalone server?

Thank you
Olivier

Yes- you can use nginx to serve static content to some requests and to pass other requests along to other servers. You can do this with different domains, subdomains or even URL paths.

Nginx can also handle the ssl certs for the xojo apps on the front-end.

Example based on my previous post.

#loadbalance instances of Xojo app
upstream myproject {
        ip_hash;
        server 127.0.0.1:8080;
        server 127.0.0.1:8081;
        server 127.0.0.1:8082;
  }

#Proxies requests to the instances above
  server {
    listen 80;
    location / {
        proxy_buffering off;
        proxy_read_timeout 5m;
        proxy_pass http://myproject;
    }

#Directly serve requests for mydomain.com/images/*  out of "/some/path/*" 
    location /images/ {
        alias /some/path/;
    }
  }

Thank you John!

ok, so:

But if the user types “http://mydomain.com”, and the Xojo instance must send data containing an image (webImageView.url=“http://mydomain.com/images/myimage.jpg”), is Nginx or Xojo which sends the image?

Yes

Yup

In my experience, if you set the url like that you will get a normal link to an image out of Xojo, so the image would be served directly from nginx, bypassing the app entirely.

[quote=29201:@John Joyce]code[/code], is Nginx or Xojo which sends the image?

In my experience, if you set the url like that you will get a normal link to an image out of Xojo, so the image would be served directly from nginx, bypassing the app entirely.[/quote]
Right. Xojo sends html to the browser, which interprets it, including loading images from their url.

Great! Thank you John and Tim.