1

i worked with laravel 5.7, in local it run good, but after i deployed the app to production server (heroku) the CSS and JS seems not working. what should i do?

this the url "https://arrahnu-demo.herokuapp.com/

<head>
  <meta charset="utf-8">
  <title>Arrahnu Gadai Indonesia</title>
  <meta content="width=device-width, initial-scale=1.0" name="viewport">
  <meta content="" name="keywords">
  <meta content="" name="description">

  <!-- Favicons -->
  <link href="{{asset('/img/favicon.png')}}" rel="icon">
  <link href="{{asset('/img/apple-touch-icon.png')}}" rel="apple-touch-icon">

  <!-- Google Fonts -->
  <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,700,700i|Raleway:300,400,500,700,800|Montserrat:300,400,700" rel="stylesheet">


  <!-- Bootstrap CSS File -->

  <link href="{{asset('/lib/bootstrap/css/bootstrap.css')}}" rel="stylesheet">

  <!-- Libraries CSS Files -->
  <link href="{{asset('/lib/font-awesome/css/font-awesome.min.css')}}" rel="stylesheet">
  <link href="{{asset('/lib/animate/animate.min.css')}}" rel="stylesheet">
  <link href="{{asset('/lib/ionicons/css/ionicons.min.css')}}" rel="stylesheet">
  <link href="{{asset('/lib/owlcarousel/assets/owl.carousel.min.css')}}" rel="stylesheet">
  <link href="{{asset('/lib/magnific-popup/magnific-popup.css')}}" rel="stylesheet">
  <link href="{{asset('/lib/ionicons/css/ionicons.min.css')}}" rel="stylesh">
  <!-- Main Stylesheet File -->
  <link href="{{asset('/css/style.css')}}" rel="stylesheet">


</head>
2
  • Try to replace relative URLs with absolute one based on your runtime environment. So, replace the call to {{asset('/css/style.css')}}, which is a relative URL processed by the asset() helper, with a absolute URL for every file needed. If in production, do https://<yourDomain.Name>/css/style.css And if local, do localhost:<PORT>/css/style.css Every framework/language/environment has a way to detect if you are local (in dev machine) or remote (in a production or test machine). Hope this helps. Commented Mar 3, 2019 at 19:33
  • Thank you ranieribt, i was solve the problem with this way, but really dont understand, what actually happend to my code, could you explain that. Commented Mar 4, 2019 at 8:24

1 Answer 1

3

Your <link>s are fetching http instead of https. And as your website on Heroku is served through https, the browser is blocking the mixed content.

Sign up to request clarification or add additional context in comments.

1 Comment

This was indeed the cause of the problem a solution can be found stackoverflow.com/questions/34378122/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.