title: Laravel 405 Method Not Allowed calling POST method via GET
body: <p>Whenever I am trying to make an ajax call with base64 image in body it gives error as: </p>
  
  <p>The GET method is not supported for this route. Supported methods: POST.</p>
  
  <p>Here is my ajax call:</p>
  
  <pre><code>async function addToCart() {
  
          document.getElementById('preloader').style.display = 'block';
          document.getElementById('addToCartButton').style.display = 'none';
          // Get base64URL
          var image = "";
          var full_image = "";
          if (document.getElementById("category_id").value == 'customize back cover') {
              //console.log("652")
              await html2canvas(document.getElementById("html-content-holder")).then(function (canvas) {
                  document.body.appendChild(canvas);
                  var base64URL = canvas.toDataURL('image/jpeg').replace('image/jpeg', 'image/octet-stream');
                  full_image = base64URL;
                  image = document.getElementById('selectedImage').src;
              });
          }
          $.ajax({
              type: "POST",
              url: "http://emlt.thebakeologyindia.com/add_to_cart", // You add the id of the post and the update datetime to the url as well
              data: {
                  _token: document.getElementById('token').value,
                  user_id: document.getElementById('user_id').value,
                  product_id: document.getElementById('product').value,
                  quantity: document.getElementById('quantity').value,
                  image: image,
                  full_image: full_image
              },
              success: function (response) {
                  // If not false, update the post
                  //console.log(response);
                  swal({
                      title: response.data.status,
                      text: response.data.message,
                      icon: response.data.status,
                  });
                  if(response.data.status == "error")
                  {
                  document.getElementById('addToCartButton').style.display = 'block';
                  document.getElementById('preloader').style.display = 'none';
                  }
                  else
              {
                  document.getElementById('itemInCartLink').style.display = 'block';
                  document.getElementById('addToCartButton').style.display = 'none';
                  document.getElementById('preloader').style.display = 'none';
              }
              },
              error: function (error) {
                  document.getElementById('addToCartButton').style.display = 'block';
                  document.getElementById('preloader').style.display = 'none';
                 swal({
                      title: "Error",
                      text: error.message,
                      icon: "error",
                  });
              }
          });
      }
  </code></pre>
  
  <p>Here is the form data example:</p>
  
  <pre><code>_token: RHJrQ4wX6XbXqi0wOx8sMiFHCuXVI2HclGB3rDco, user_id: 1, product_id: 1, quantity: 1, image:    data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAu8AAAH0CAYAAACNesOUAAAgAElEQVR4XoS9iZLjWnIsGMRCAlxy..........,    full_image:    data:image/octet-stream;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBg..........,
  </code></pre>
  
  <p>If I remove the images then it works fine. And it also works perfectly in localhost. This issue occurs in server only.
  Here is the link of the website: <a href="http://emlt.thebakeologyindia.com/details/1" rel="nofollow noreferrer">http://emlt.thebakeologyindia.com/details/1</a>. You can add any other product it will work fine but when you will try to add customize back cover products then this issue occurs because then only I am sending the images. I am not able to figure out what the problem is.</p>
  
  <p>Here is the complete error log:</p>
  
  <pre><code>{
      "message": "The GET method is not supported for this route. Supported methods: POST.",
      "exception": "Symfony\\Component\\HttpKernel\\Exception\\MethodNotAllowedHttpException",
      "file": "/home/thebvcgn/MobileCoverEcom/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php",
      "line": 256,
      "trace": [
          {
              "file": "/home/thebvcgn/MobileCoverEcom/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php",
              "line": 242,
              "function": "methodNotAllowed",
              "class": "Illuminate\\Routing\\RouteCollection",
              "type": "-&gt;"
          },
          {
              "file": "/home/thebvcgn/MobileCoverEcom/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php",
              "line": 176,
              "function": "getRouteForMethods",
              "class": "Illuminate\\Routing\\RouteCollection",
              "type": "-&gt;"
          },
          {
              "file": "/home/thebvcgn/MobileCoverEcom/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
              "line": 634,
              "function": "match",
              "class": "Illuminate\\Routing\\RouteCollection",
              "type": "-&gt;"
          },
          {
              "file": "/home/thebvcgn/MobileCoverEcom/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
              "line": 623,
              "function": "findRoute",
              "class": "Illuminate\\Routing\\Router",
              "type": "-&gt;"
          },
          {
              "file": "/home/thebvcgn/MobileCoverEcom/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
              "line": 612,
              "function": "dispatchToRoute",
              "class": "Illuminate\\Routing\\Router",
              "type": "-&gt;"
          },
          {
              "file": "/home/thebvcgn/MobileCoverEcom/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
              "line": 176,
              "function": "dispatch",
              "class": "Illuminate\\Routing\\Router",
              "type": "-&gt;"
          },
          {
              "file": "/home/thebvcgn/MobileCoverEcom/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
              "line": 30,
              "function": "Illuminate\\Foundation\\Http\\{closure}",
              "class": "Illuminate\\Foundation\\Http\\Kernel",
              "type": "-&gt;"
          },
          {
              "file": "/home/thebvcgn/MobileCoverEcom/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
              "line": 21,
              "function": "Illuminate\\Routing\\{closure}",
              "class": "Illuminate\\Routing\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/thebvcgn/MobileCoverEcom/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
              "line": 163,
              "function": "handle",
              "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
              "type": "-&gt;"
          },
          {
              "file": "/home/thebvcgn/MobileCoverEcom/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
              "line": 53,
              "function": "Illuminate\\Pipeline\\{closure}",
              "class": "Illuminate\\Pipeline\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/thebvcgn/MobileCoverEcom/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
              "line": 21,
              "function": "Illuminate\\Routing\\{closure}",
              "class": "Illuminate\\Routing\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/thebvcgn/MobileCoverEcom/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
              "line": 163,
              "function": "handle",
              "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
              "type": "-&gt;"
          },
          {
              "file": "/home/thebvcgn/MobileCoverEcom/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
              "line": 53,
              "function": "Illuminate\\Pipeline\\{closure}",
              "class": "Illuminate\\Pipeline\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/thebvcgn/MobileCoverEcom/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php",
              "line": 27,
              "function": "Illuminate\\Routing\\{closure}",
              "class": "Illuminate\\Routing\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/thebvcgn/MobileCoverEcom/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
              "line": 163,
              "function": "handle",
              "class": "Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize",
              "type": "-&gt;"
          },
          {
              "file": "/home/thebvcgn/MobileCoverEcom/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
              "line": 53,
              "function": "Illuminate\\Pipeline\\{closure}",
              "class": "Illuminate\\Pipeline\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/thebvcgn/MobileCoverEcom/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php",
              "line": 62,
              "function": "Illuminate\\Routing\\{closure}",
              "class": "Illuminate\\Routing\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/thebvcgn/MobileCoverEcom/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
              "line": 163,
              "function": "handle",
              "class": "Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode",
              "type": "-&gt;"
          },
          {
              "file": "/home/thebvcgn/MobileCoverEcom/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
              "line": 53,
              "function": "Illuminate\\Pipeline\\{closure}",
              "class": "Illuminate\\Pipeline\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/thebvcgn/MobileCoverEcom/vendor/fideloper/proxy/src/TrustProxies.php",
              "line": 57,
              "function": "Illuminate\\Routing\\{closure}",
              "class": "Illuminate\\Routing\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/thebvcgn/MobileCoverEcom/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
              "line": 163,
              "function": "handle",
              "class": "Fideloper\\Proxy\\TrustProxies",
              "type": "-&gt;"
          },
          {
              "file": "/home/thebvcgn/MobileCoverEcom/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
              "line": 53,
              "function": "Illuminate\\Pipeline\\{closure}",
              "class": "Illuminate\\Pipeline\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/thebvcgn/MobileCoverEcom/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
              "line": 104,
              "function": "Illuminate\\Routing\\{closure}",
              "class": "Illuminate\\Routing\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/thebvcgn/MobileCoverEcom/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
              "line": 151,
              "function": "then",
              "class": "Illuminate\\Pipeline\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/thebvcgn/MobileCoverEcom/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
              "line": 116,
              "function": "sendRequestThroughRouter",
              "class": "Illuminate\\Foundation\\Http\\Kernel",
              "type": "-&gt;"
          },
          {
              "file": "/home/thebvcgn/emlt.site/index.php",
              "line": 55,
              "function": "handle",
              "class": "Illuminate\\Foundation\\Http\\Kernel",
              "type": "-&gt;"
          }
      ]
  }
  </code></pre>