Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails route helpers are inexplicably prepending "postinstall" to requests

* Listening on tcp://0.0.0.0:3000

Started GET "postinstall/" for 127.0.0.1 at 2013-10-27 07:26:15 +0000
ActiveRecord::SchemaMigration Load (1.8ms)  SELECT "schema_migrations".* FROM "schema_migrations"

This is basically it, all my buttons linked to helpers like:

new_user_registration GET      /users/sign_up(.:format)               registrations#new
edit_user_registration GET      /users/edit(.:format)                  registrations#edit

Only all the links are like this:

http://localhost:3000/postinstall/users/sign_in

I've been through my log and at one point requests just start being effectively poisoned by this "postinstall" business.

I've grepped for 'postinstall' because surely this word can't be coming from nowhere. I decided to sleep on it because I thought it must be a stupid mistake, but now I need help and unlike 99.9% of my previous questions - it doesn't seem this one has been answered whatsoever.

Searching for even the query "postinstall" on Google yields terrible results.

I THINK my problem lies in a path helper, everywhere the 'postinstall' is getting prepended to requests/urls - the path is referred to like so:

<a href="/users/sign_in" class="btn btn-success">Test</a>

<%= link_to "Sign In", new_user_session_path, :class => "btn btn-success" %>

Where the first link would work route OK, but then the buttons to Submit the login form are trying the POST to /postinstall/users/sign_in etc... The second button would be a link to /postinstall/users etc.

I have absolutely no idea how this started, I've been over my git log and even going back 3 or 4 days (this issue started last night) the error still persists.

Is it seemingly specific to my Mac too, deployed to a dev site (Ubuntu) with no issues. I have restarted my mac etc. Any help is very obviously appreciated...

like image 292
Willl Avatar asked Oct 27 '13 08:10

Willl


2 Answers

I had the same problem.

I'm using puma as webserver, and puma uses a ENV called 'SCRIPT_NAME' which was setted with 'postinstall' value after i installed a software, doing puma inject 'postinstall' on url.

if you still having this issue, unset SCRIPT_NAME var from your ENV, using the command on shell unset SCRIPT_NAME.

like image 174
Henrique Sobral Gomes Avatar answered Oct 16 '22 00:10

Henrique Sobral Gomes


If you are using TotalTerminal, the recent update leaves the SCRIPT_NAME environment variable set after the update. Rebooting the computer solves the issue.

I started a new topic on Binary Age's support site to try to get this fixed: http://discuss.binaryage.com/t/totalterminal-update-overrides-script-name-breaks-webservers/897

like image 40
johnboiles Avatar answered Oct 16 '22 01:10

johnboiles