Posts

Showing posts from May, 2020

Add CORS to Nginx on AWS Elastic Beanstalk

Image
Apache Add the following block to your  .htaccess  file: <FilesMatch ".(eot|otf|ttf|woff|woff2)"> Header always set Access-Control-Allow-Origin "*" </FilesMatch> Nginx Add the following location block to your virtual host file (usually within the server directive) and reload Nginx: location ~* \.(eot|otf|ttf|woff|woff2)$ { add_header Access-Control-Allow-Origin *; } Invalidate CloudFront Distribution Once the changes have been made you will need to  invalidate the CloudFront cache  with a path of “/*”. Integrating to CloudFront service It’s simple to config and use CloudFront (a CDN service) for Rails app.  Just one thing from my experience, regarding to CORS issue on EB when your CSS want get loading font files or font-awesome. Because EB run your app with Nginx server serve public static files, then work around would be overwriting web server config in Nginx with  add_header Access-Cont...

SMTP Credentials

11.SMTP Credentials :  its use for get password by mailer app/config/ envernments/ development.rb development.rb config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } config.action_mailer.perform_deliveries = true config.action_mailer.raise_delivery_errors = true config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { address: 'smtp.gmail.com', port: 587, domain: 'localhost', user_name: 'testing.bittern@gmail.com', password: 'bittern1234', authentication: 'plain', enable_starttls_auto: true }

Bootstrap-form-validation

http://twitterbootstrap.org/bootstrap-form-validation http://twitterbootstrap.org/

Adding a column to an existing table in a Rails migration

Use this command at rails console rails generate migration add_fieldname_to_tablename fieldname : string and rake db : migrate to run this migration

Remove a column with migration:

rails g migration RemoveCountryFromSampleApps country : string This will generate the following migration  in Rails 5.0 : class RemoveCountryFromSampleApps < ActiveRecord :: Migration [ 5.0 ] def change remove_column : sample_apps , : country , : string end end