crowdAI / crowdai

Fighting for Open Science with Open Data
https://www.crowdai.org
GNU Affero General Public License v3.0
149 stars 32 forks source link

Reverse proxy to crowdAI #1110

Open heroxbd opened 5 years ago

heroxbd commented 5 years ago

I am trying to have a reverse proxy (with a different domain name) to our crowdAI site. But by adding a simple nginx reverse proxy site, e.g.

    location / {
                sub_filter_once off;
                sub_filter_types text/html;
                sub_filter "https://<real domain>" "https://<proxy domain>";
proxy_cache nginx-cache ;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 50m;
client_body_buffer_size 256k;
proxy_connect_timeout 30s;
proxy_send_timeout 60s;
proxy_read_timeout 120s;
proxy_buffer_size 256k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_temp_file_write_size 256k;
proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;
proxy_max_temp_file_size 128m;
        proxy_pass https://<real-domain>/;
        proxy_redirect default ;
    }

But the site gives unverified_request error:

21:29:49 web.1    | 2019-04-30T13:29:49.373Z 11697 TID-gpzr00u71 INFO: Started POST "/participants/sign_in" for 2001:250:200:1:b586:110:0:1 at 2019-04-30 21:29:49 +0800                                            21:29:49 web.1    |   Participant Load (1.4ms)  SELECT  "participants".* FROM "participants" WHERE "participants"."email" = $1 ORDER BY name ASC LIMIT $2  [["email", "<user email>"], ["LIMIT", 1]]
21:29:49 web.1    | 2019-04-30T13:29:49.606Z 11697 TID-gpzr00u71 FATAL:                                                                                                                                             21:29:49 web.1    | 2019-04-30T13:29:49.606Z 11697 TID-gpzr00u71 FATAL: ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken):
21:29:49 web.1    | 2019-04-30T13:29:49.606Z 11697 TID-gpzr00u71 FATAL:   
21:29:49 web.1    | 2019-04-30T13:29:49.606Z 11697 TID-gpzr00u71 FATAL: actionpack (5.2.2) lib/action_controller/metal/request_forgery_protection.rb:211:in `handle_unverified_request'

Is there some documentation to build a reverse proxy for a crowdAI site?

scarroll32 commented 5 years ago

Hi @heroxbd, crowdAI was built to run on Heroku, but it is a standard Rails app so should be configurable to run on a VPS. It seems like something is not configured correctly on the server, can I suggest reviewing this guide.

Also, you might do well to ask this question over at AIcrowd, where there is more active development underway on a fork of crowdAI.

That is very interesting you are running a crowdAI instance. Can you tell us about it?

Best, Sean

heroxbd commented 5 years ago

Hi @heroxbd, crowdAI was built to run on Heroku, but it is a standard Rails app so should be configurable to run on a VPS. It seems like something is not configured correctly on the server, can I suggest reviewing this guide.

I see. I am going to have a standard Rails apps reverse proxy.

Also, you might do well to ask this question over at AIcrowd, where there is more active development underway on a fork of crowdAI.

What's the relations between AIcrowd and crowdAI? What will happen to crowdAI?

That is very interesting you are running a crowdAI instance. Can you tell us about it?

Sure, we are running it for a neutrino data analysis contest at Tsinghua University, Beijing. The site is available via IPv6 at https://data-contest.net9.org or a (somewhat slow) reverse proxy at https://dc.airelinux.org.