croptool icon indicating copy to clipboard operation
croptool copied to clipboard

Simplify setup for frontend only development

Open simon04 opened this issue 9 years ago • 2 comments

When only developing the AngularJS frontent, the backend.php can be proxied from the live instance from https://tools.wmflabs.org/croptool/backend.php. This drops the requirement of an OAuth token etc.

A quick solution was setting the following entries in /etc/nginx/sites-enabled/nginx_vhost inside the vagrant instance (208.80.155.131 corresponds to the IP address of tools.wmflabs.org):

    location / {
        proxy_pass https://208.80.155.131/;
        try_files $uri $uri/ =404;
    }
    location /croptool/ {
        root /var/www/html/;
    }
    location /croptool/files {
        proxy_pass https://208.80.155.131/croptool/files;
    }
    location /croptool/backend.php {
        proxy_pass https://208.80.155.131/croptool/backend.php;
    }

I'm certain that there are simpler solutions …

simon04 avatar Apr 19 '16 20:04 simon04

Yeah, some info about this would be nice to have in the readme. I can't think of a simpler solution right now.

danmichaelo avatar Apr 19 '16 21:04 danmichaelo

Another approach would be to send an appropriate Access-Control-Allow-Origin header in backend.php in order to allow the frontend run on http://localhost:8000 (e.g. using php -S localhost:8000) and use https://tools.wmflabs.org/croptool/backend.php for the API calls.

simon04 avatar Apr 19 '16 21:04 simon04