While posting form with miltiple images i get different redirect than while posting on local.
Online server has Phusion Passenger Apache/nginx.
Local Server uses standard Webrick.
Rails 3.0.9
Application is internationalized (2 languages) English and Croatian
On Local machine there is no problem it redirects perfectly.
http://localhost:3000/en/references
Online Server redirects with extra language segment in URL.
http://somesite.com/en/en/references
This throws error, page doesn’t exist.
controller update action:
def update
@reference = Reference.find(params[:id])
if @reference.update_attributes(params[:reference])
redirect_to(references_path, :notice => 'Reference was successfully updated.')
else
render :action => "edit"
end
end
Routes are handled like this.
scope "(:locale)", :locale => /hr|en/ do
resources :references
resources :reference_groups
resources :pages
resources :photos
end
Log output from server is:
Started POST "/hr/references/1" for 78.0.196.78 at Wed Nov 23 12:55:11 +0100 2011
Processing by ReferencesController#update as HTML
Parameters: {"reference"=>{"name_en"=>"Test Reference", "position"=>"1"...}
[paperclip] Saving attachments.
[paperclip] saving /home/alfaplan/alfaplan/public/images/photos/medium/katalog-zaks_012-l.jpg
[paperclip] saving /home/alfaplan/alfaplan/public/images/photos/thumb/katalog-zaks_012-l.jpg
[paperclip] saving /home/alfaplan/alfaplan/public/images/photos/original/katalog-zaks_012-l.jpg
Redirected to http://alfaplan.host25.com/hr/hr/references
Completed 302 Found in 1344ms
Started GET "/hr/hr/references" for 78.0.196.78 at Wed Nov 23 12:55:12 +0100 2011
ActionController::RoutingError (No route matches "/hr/hr/references"):
Any ideas where the problem might be?
I am fairly new to RoR and this is my first question here.
Here it goes.
It seems to be a Paperclip – Apache bug.
Disabling mod_security in Apache cconfiguration, or if available in .htaccess file prevents doubling your URL segment.
Disabling mod_security isn’t very smart so people from hosting are now trying to isolate mod_security rule which is causing the problem.
Pulled answer here http://railsforum.com/viewtopic.php?id=42079.