WEBGL Stalling Redirect


#1

I have a WEBGL player embedded in a rails static page as ‘demo_path’ like below:

<% provide(:title, 'Sign up') %>
<h1>Sign up</h1>

<div class="row">
<div class="col-md-6 col-md-offset-3">
<%= form_for(@user, url: signup_path) do |f| %>
  <%= render 'shared/error_messages' %>

  <%= link_to "mindpass", demo_path, class: "btn btn-lg btn-primary" 
%>

  <%= f.submit "Create my account", class: "btn btn-primary" %>
<% end %>
</div>
</div>

When the user clicks the button, it loads the webgl template:

<!DOCTYPE html>
<html lang="en-us">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf- 
8">
<title>Unity WebGL Player | MindPass_DEMO</title>
<script src="Build/UnityLoader.js"></script>
<script>
  var gameInstance = UnityLoader.instantiate("gameContainer", 
"/assets/Build/MindPass_WEBGL_RY2.json");
</script>
</head>
<body>
<div id="gameContainer" style="width: 90%; height: 90%; position: 
absolute; margin: auto;"></div>
  </body>
</html>

This loads successfully and actually initiates the users controller to save a new user and initiates the ‘redirect_to @users’ as shown in the following users_controller code:

def create
    puts "create runs"
    #puts params.inspect
    @user = User.new(user_params)
    if @user.save

      puts "user save runs"
      log_in @user
      puts "second welcome to your vault(users_cont)"
      flash[:success] = "Welcome to your vault!"
      redirect_to @user
    else
      puts "render new runs"
      render 'new'
    end
  end

The problem is that the redirect doesn’t actually happen. Here is the log from the attempt, including the redirect:

2018-11-07T05:04:21.897020+00:00 app[web.1]: I,

[2018-11-07T05:04:21.896891 #20] INFO – : [c5de6e8e-58e2-4177-ae17-e1f58fbb65ee] Started POST “/signup” for 76.120.71.73 at 2018-11-07 05:04:21 +0000 2018-11-07T05:04:21.898131+00:00 app[web.1]: I,

[2018-11-07T05:04:21.898049 #20] INFO – : [c5de6e8e-58e2-4177-ae17-e1f58fbb65ee] Processing by UsersController#create as / 2018-11-07T05:04:21.901161+00:00 app[web.1]: I, [2018-11-07T05:04:21.901036 #20] INFO – : [c5de6e8e-58e2-4177-ae17-e1f58fbb65ee] Parameters: {“EMAIL”=>"jakeywtf34@gmail.com", “PASSWORD”=>"[FILTERED]"}

2018-11-07T05:04:21.902007+00:00 app[web.1]: W, [2018-11-07T05:04:21.901922 #20] WARN – : [c5de6e8e-58e2-4177-ae17-e1f58fbb65ee] Can’t verify CSRF token authenticity. 2018-11-07T05:04:21.907902+00:00 app[web.1]: create runs

2018-11-07T05:04:21.907965+00:00 app[web.1]: user_params runs

2018-11-07T05:04:21.908031+00:00 app[web.1]: unless state in user_params 2018-11-07T05:04:22.141541+00:00 app[web.1]: D,

[2018-11-07T05:04:22.141393 #20] DEBUG – : [c5de6e8e-58e2-4177-ae17-e1f58fbb65ee] [1m[35m (5.0ms)[0m [1m[35mBEGIN[0m 2018-11-07T05:04:22.145580+00:00 app[web.1]: D, [2018-11-07T05:04:22.145463 #20] DEBUG – : [c5de6e8e-58e2-4177-ae17-e1f58fbb65ee] [1m[36mUser Exists (2.5ms)[0m [1m[34mSELECT 1 AS one FROM “users” WHERE LOWER(“users”.“email”) = LOWER($1) LIMIT $2[0m [[“email”, "jakeywtf34@gmail.com"], [“LIMIT”, 1]]

2018-11-07T05:04:22.149368+00:00 app[web.1]: D,

[2018-11-07T05:04:22.149270 #20] DEBUG – : [c5de6e8e-58e2-4177-ae17-e1f58fbb65ee] [1m[35mSQL (2.1ms)[0m [1m[32mINSERT INTO “users” (“email”, “created_at”, “updated_at”, “password_digest”) VALUES ($1, $2, $3, $4) RETURNING “id”[0m [[“email”, "jakeywtf34@gmail.com"], [“created_at”, “2018-11-07 05:04:22.146010”], [“updated_at”, “2018-11-07 05:04:22.146010”], [“password_digest”, “$2a$10$g.RhGJDfl23/zPDeyXEI.OcnsfKfYH3jE4GB7py6/ktMJ3N6y73OW”]]

2018-11-07T05:04:22.153387+00:00 app[web.1]: D,

[2018-11-07T05:04:22.153287 #20] DEBUG – : [c5de6e8e-58e2-4177-ae17-e1f58fbb65ee] [1m[35m (3.5ms)[0m [1m[35mCOMMIT[0m 2018-11-07T05:04:22.153528+00:00 app[web.1]: user save runs 2018-11-07T05:04:22.153618+00:00 app[web.1]: second welcome to your vault(users_cont) 2018-11-07T05:04:22.154318+00:00 app[web.1]: I,

[2018-11-07T05:04:22.154239 #20] INFO – : [c5de6e8e-58e2-4177-ae17-e1f58fbb65ee] Redirected to https://immense-castle-53592.herokuapp.com/users/126

2018-11-07T05:04:22.154585+00:00 app[web.1]: I,

[2018-11-07T05:04:22.154507 #20] INFO – : [c5de6e8e-58e2-4177-ae17-e1f58fbb65ee] Completed 302 Found in 253ms (ActiveRecord: 13.0ms) 2018-11-07T05:04:22.221827+00:00 app[web.1]: I,

[2018-11-07T05:04:22.221705 #6] INFO – : [972376e5-2f11-4985-91fe-53b071181359] Started GET “/users/126” for 76.120.71.73 at 2018-11-07 05:04:22 +0000 2018-11-07T05:04:22.229274+00:00 app[web.1]: I,

[2018-11-07T05:04:22.229112 #6] INFO – : [972376e5-2f11-4985-91fe-53b071181359] Processing by UsersController#show as / 2018-11-07T05:04:22.230258+00:00 app[web.1]: I,

[2018-11-07T05:04:22.230174 #6] INFO – : [972376e5-2f11-4985-91fe-53b071181359] Parameters: {“id”=>“126”}

2018-11-07T05:04:22.156370+00:00 heroku[router]: at=info method=POST path="/signup" host=immense-castle-53592.herokuapp.com request_id=c5de6e8e-58e2-4177-ae17-e1f58fbb65ee fwd=“76.120.71.73” dyno=web.1 connect=1ms service=264ms status=302 bytes=559 protocol=https 2018-11-07T05:04:22.419460+00:00 app[web.1]: D,

[2018-11-07T05:04:22.419270 #6] DEBUG – : [972376e5-2f11-4985-91fe-53b071181359] [1m[36mUser Load (6.4ms)[0m [1m[34mSELECT “users”.* FROM “users” WHERE “users”.“id” = $1 LIMIT $2[0m [[“id”, 126], [“LIMIT”, 1]]

2018-11-07T05:04:22.469417+00:00 app[web.1]: I,

[2018-11-07T05:04:22.469246 #6] INFO – : [972376e5-2f11-4985-91fe-53b071181359] Rendering users/show.html.erb within layouts/application 2018-11-07T05:04:22.470569+00:00 app[web.1]: I,

[2018-11-07T05:04:22.470487 #6] INFO – : [972376e5-2f11-4985-91fe-53b071181359] Rendered users/show.html.erb within layouts/application (1.0ms) 2018-11-07T05:04:22.484847+00:00 app[web.1]: I,

[2018-11-07T05:04:22.484727 #6] INFO – : [972376e5-2f11-4985-91fe-53b071181359] Rendered layouts/_rails_default.html.erb (4.8ms)

2018-11-07T05:04:22.497488+00:00 app[web.1]: I,

[2018-11-07T05:04:22.497361 #6] INFO – : [972376e5-2f11-4985-91fe-53b071181359] Rendered layouts/_shim.html.erb (0.5ms) 2018-11-07T05:04:22.526778+00:00 app[web.1]: I,

[2018-11-07T05:04:22.526644 #6] INFO – : [972376e5-2f11-4985-91fe-53b071181359] Rendered layouts/_header.html.erb (12.1ms) 2018-11-07T05:04:22.540219+00:00 app[web.1]: I,

[2018-11-07T05:04:22.540092 #6] INFO – : [972376e5-2f11-4985-91fe-53b071181359] Rendered layouts/_footer.html.erb (1.0ms) 2018-11-07T05:04:22.541427+00:00 app[web.1]: I,

[2018-11-07T05:04:22.541342 #6] INFO – : [972376e5-2f11-4985-91fe-53b071181359] Completed 200 OK in 311ms (Views: 83.8ms | ActiveRecord: 103.3ms)

2018-11-07T05:04:22.544712+00:00 heroku[router]: at=info method=GET path="/users/126" host=immense-castle-53592.herokuapp.com request_id=972376e5-2f11-4985-91fe-53b071181359 fwd=“76.120.71.73” dyno=web.1 connect=1ms service=324ms status=200 bytes=2692 protocol=https

When I do this with normal form inputs like below, the same redirect log happens, and it actually goes to the users page.:

  <%= f.label :email %>
  <%= f.email_field :email, class: 'form-control' %>

  <%= f.label :password %>
  <%= f.password_field :password, class: 'form-control' %>

It seems as if WEBGL is locking this thing up and refusing the page to actually redirect, even though it should be happening . What am I missing?

UPDATE 12-6-18:

I noticed that when redirect is initiated by WEBGL (unsuccessful) I get this in the log: Processing by UsersController#show as / . If I redirect from a normal html form (successful) I get this in the log: Processing by UsersController#show as HTML. This is the only difference in the logs.

I have tested for the following:

  1. Tested with multiple browsers to see if it was specific to certain ones
  2. Tested with changing the redirect URL to https://www.google.co.uk/ to see if redirect was successful
  3. Added a condition to ensure that the redirection was finished before moving on with the scripts
  4. Attempted testing off of Heroku via LocalHost (still did not proceed) Sadly, none of these tests have yielded any telling results.