Laravel livewire getting The POST method is not supported on server

Viewed 35

After developing an application with Laravel and Livewire after uploading the application on subdomain of server i get this error for all of livewire components which i want to post form to component and i can't resolve this problem

app.blade.php

<!DOCTYPE html>
<html lang="{{App::getLocale()}}">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    ...

    @livewireStyles

    ...

    @stack('styles')
</head>

<body>
<div id="app">
    @if(Route::currentRouteName()!=='admin-login')
        <livewire:partials.top-bar-component/>
        <livewire:partials.nav-bar-component/>
    @endif

    <div class="page-content pt-0">
        @if(Route::currentRouteName()!=='admin-login')
            <livewire:partials.side-bar-component/>
        @endif

        <div class="content-wrapper pb-5">
            @yield('content')
        </div>

    </div>

        <livewire:partials.footer-component/>
</div>

@livewireScripts

<script>
    window.livewire_app_url = '{{route('administrator')}}';
</script>

@stack('scripts')

</body>

</html>

on of components which i get error in that

html form

<div>
    <form wire:submit.prevent="submit" method="POST">
        <ul class="media-list media-list-linked">
            <li class="media bg-light font-weight-semibold py-2">
                <div class="col-md-2">
                    <label class="col-form-label">
                        category name:
                    </label>
                </div>
                <div class="col-lg-10">
                    <input type="text"
                           wire:model.debounce.1500="title"
                           name="title"
                           class="form-control"/>
                    @error('title')
                    <span class="badge d-block badge-danger form-text text-left">
                       {{ $message }}
                    </span>
                    @enderror
                </div>
            </li>
        </ul>
        <div class="text-right py-4">
            <div class="btn-group" role="group">
                <button type="submit" class="btn btn-primary">save</button>
            </div>
        </div>
    </form>
</div>
@push('scripts')
@endpush

create-new-category-component:

class CreateNewCategoryComponent extends Component
{
    public string $title='';

    public Collection $categories;

    protected array $rules = [
        'title'=>'required|min:2|max:50',

    ];
    public function mount()
    {
        $this->categories = Categories::all();
    }

    public function render(): Factory|View|Application
    {
        return view('livewire.categories.create-new-category-component');
    }

    public function updated($field){
        $this->validateOnly($field);
    }

    public function submit()
    {
        $this->validate($this->rules);

        $category = new Categories();
        $category->title = $this->title;
        $category->save();

        $this->_resetForm();
    }

    public function unselectPhoto()
    {
        $this->photo = null;
    }

    public function _resetForm()
    {
        $this->title= '';
        $this->photo = null;

        $this->resetValidation();
    }
}

.httaccess:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>


<IfModule mime_module>
  AddHandler application/x-httpd-ea-php81 .php .php8 .phtml
</IfModule>

request:

Request
http://app.hello.com/root/categories
POST

curl "http://app.hello.com/root/categories" \
   -X POST \
   -H 'sec-gpc: 1' \
   -H 'dnt: 1' \
   -H 'upgrade-insecure-requests: 1' \
   -H 'cookie: remember_web_59ba36addc2b2f9401580f014c7f58ea4e30989d=eyJpdiI6IjJxVGxIWnltTUR4b25JNnVIaVBOTVE9PSIsInZhbHVlIjoiL2o4V1VzUXIrNVA1TlIvRlErNFRGYWtsdlB6eTYyb2pjeWp1VVYxR09KSk50TGFGbUtjSjVrMmpBeitaOVAyZnU0VlNObDJDb2wwd1c2ZHJ3U3RpL1JmSDhWcDN6Q2pWdXhsZlFVcWxVb1pYK1UwTW1mRHZLL0JqOVZWSnUvQmNZYjY4UDRMZ0YxNFVyRlFQblBKdi9uMGdncXhkdU9wMXA3c1ZmZzM1akhBYzdjcmZVZzRZcG9maWUzU0FxM2pUMXVrSlNkZkhtTy9JZ2Z0VkJoY2R5VW1rOUd0Qkl4WlpqSDRCd1R5djFoOD0iLCJtYWMiOiIxODVhMDc4ODA4YjZmMTYwYzZkOTQ5MWE2ZWQ1MTViODQ4Y2I1YzA1NzgwOTYxZWM0OTIxYjk3YWUzMWM3OTRjIiwidGFnIjoiIn0%3D; XSRF-TOKEN=eyJpdiI6Ild3SzFra1JBK1lmR211a3JYSWRDaXc9PSIsInZhbHVlIjoic2ltdThQREpCUUJaNzRrTzdEdm5mYjNTeUgxWDBXd0VueUU5ckdSUUpSb2dtc0ZqVS9HQmliMnJ6WkFQUXF1bzhuU3JhYVcrREhnZ3FlWXgxeWEwZUJ5TEhPcWhYQk1IN3I2c1VXd0tlbngyREloRW12ajRiUlRxMzh6YVdhdGEiLCJtYWMiOiJiODRmY2Q3MDMwZDM5MDAyNTUzY2U2YzNiZWFiZWUwOTBhYzRjMzEwNmRhZGMyY2IyOGNmYTVmZDk3YWZjMjMxIiwidGFnIjoiIn0%3D; laravel_session=eyJpdiI6IjBvd0pqbXkxMGpKOGhNdTFtVktRaEE9PSIsInZhbHVlIjoicWFwOXh3bS9ZWk1jMlJOVGtwbUpkc1BYY1U0bGlGUCtUV3EzRDR4UjJrbE9peGlYbDQ5N2g1dDBLYUM0T2djV0wvclpNRklsUGxwVzZkSmxYaUYyV01GRHBDZ1crTzAvQkZGQkc5VzRvUWoyVkwyYWxtclE5ZDVhS093VGJaR3EiLCJtYWMiOiI4MWVkMTUyYzI2M2I0NDI2Njg4YjMyZGE2ZTZiZDdiY2E0NTEwOWE0YTk5YmY0MjdkYWEzZTNjZjU5MDk1YzQ1IiwidGFnIjoiIn0%3D' \
   -H 'origin: http://app.hello.com' \
   -H 'content-type: application/x-www-form-urlencoded' \
   -H 'accept-language: en-US,en;q=0.5' \
   -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8' \
   -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:104.0) Gecko/20100101 Firefox/104.0' \
   -H 'content-length: 13' \
   -H 'x-real-ip: ::ffff:' \
   -H 'x-forwarded-server: app.hello.com' \
   -H 'x-forwarded-proto: http' \
   -H 'x-forwarded-port: 80' \
   -H 'x-forwarded-host: app.hello.com' \
   -H 'x-forwarded-for: ::ffff:' \
   -H 'referer: http://app.hello.com/root/categories' \
   -H 'host: app.hello.com' \
   -F 'title=sdfsdfs'

routes:


  POST       _ignition/execute-solution .................................................................. ignition.executeSolution › Spatie\LaravelIgnition › ExecuteSolutionController
  GET|HEAD   _ignition/health-check .............................................................................. ignition.healthCheck › Spatie\LaravelIgnition › HealthCheckController
  POST       _ignition/update-config ........................................................................... ignition.updateConfig › Spatie\LaravelIgnition › UpdateConfigController
  POST       api/v1/all-orders ........................................................................................................................ Api\V1\OrderController@allOrders
  POST       api/v1/cancel-order .................................................................................................................... Api\V1\OrderController@cancelOrder
  POST       api/v1/check-order-status ......................................................................................................... Api\V1\OrderController@checkOrderStatus
  POST       api/v1/discount-code ............................................................................................................ Api\V1\TransactionController@discountCode
  POST       api/v1/get-address ....................................................................................................................... Api\V1\UserController@getAddress
  POST       api/v1/get-categories ................................................................................................................. Api\V1\UserController@getCategories
  POST       api/v1/get-category-products .................................................................................................... Api\V1\UserController@getCategoryProducts
  POST       api/v1/get-data ............................................................................................................................. Api\V1\UserController@getData
  POST       api/v1/get-days ............................................................................................................................. Api\V1\UserController@getDays
  POST       api/v1/get-delivery-times .......................................................................................................... Api\V1\UserController@getDeliveryTimes
  POST       api/v1/get-order .......................................................................................................................... Api\V1\OrderController@getOrder
  POST       api/v1/get-products-service ....................................................................................................... Api\V1\UserController@getProductService
  POST       api/v1/get-receive-times ............................................................................................................ Api\V1\UserController@getReceiveTimes
  POST       api/v1/get-test .......................................................................................................................... Api\V1\UserController@testOrders
  POST       api/v1/get-wallet .................................................................................................................. Api\V1\TransactionController@getWallet
  POST       api/v1/login ..............................................................................................................................................................
  POST       api/v1/peyk-delivery-order ....................................................................................................... Api\V1\PeyksController@peykDeliveryOrder
  POST       api/v1/peyk-login ........................................................................................................................ Api\V1\PeyksController@peykLogin
  POST       api/v1/peyk-new-orders ............................................................................................................... Api\V1\PeyksController@peykNewOrders
  POST       api/v1/peyk-orders ...................................................................................................................... Api\V1\PeyksController@peykOrders
  POST       api/v1/peyk-receive-order ......................................................................................................... Api\V1\PeyksController@peykReceiveOrder
  POST       api/v1/profile .............................................................................................................................. Api\V1\UserController@profile
  POST       api/v1/save-address ..................................................................................................................... Api\V1\UserController@saveAddress
  POST       api/v1/send-validation-code ...................................................................................................... Api\V1\UserController@sendValidationCode
  POST       api/v1/set-order .......................................................................................................................... Api\V1\OrderController@setOrder
  POST       api/v1/sign-up ............................................................................................................................... Api\V1\UserController@signup
  POST       api/v1/store-address .................................................................................................................... Api\V1\UserController@saveAddress
  POST       api/v1/transactions ......................................................................................................... Api\V1\TransactionController@transactionsList
  POST       api/v1/validate-code ............................................................................................................ Api\V1\UserController@checkValidationCode
  GET|POST|HEAD broadcasting/auth ........................................................................................... Illuminate\Broadcasting › BroadcastController@authenticate
  ANY        callback_payment/{orderId} ............................................................................................................................... callback_payment
  GET|HEAD   chat ......................................................................................................................................................................
  GET|HEAD   jarbon/status ..................................................................................................................... Mokhosh\Jarbon › JarbonStatusController
  GET|HEAD   livewire/livewire.js ............................................................................................... Livewire\Controllers › LivewireJavaScriptAssets@source
  GET|HEAD   livewire/livewire.js.map ............................................................................................. Livewire\Controllers › LivewireJavaScriptAssets@maps
  POST       livewire/message/{name} ................................................................................... livewire.message › Livewire\Controllers › HttpConnectionHandler
  GET|HEAD   livewire/preview-file/{filename} ................................................................. livewire.preview-file › Livewire\Controllers › FilePreviewHandler@handle
  POST       livewire/upload-file ............................................................................... livewire.upload-file › Livewire\Controllers › FileUploadHandler@handle
  GET|HEAD   page/login .............................................................................................................................. login › Auth\LoginController@show
  POST       page/login ..................................................................................................................................... Auth\LoginController@login
  GET|HEAD   pay/{orderId}/{discountCode?} .............................................................................................................................................
  GET|HEAD   root/administrator .................................................................................................................. administrator › AdminController@panel
  GET|HEAD   root/categories ................................................................................................................... categories › AdminController@categories
  GET|HEAD   root/edit-product/{id?} ........................................................................................................ edit-product › AdminController@editProduct
  GET|HEAD   root/manage-customers .................................................................................................. manage-customers › AdminController@manageCustomers
  GET|HEAD   root/manage-delivery-times .................................................................................. manage-delivery-times › AdminController@manageDeliveriesTimes
  GET|HEAD   root/manage-discount-codes .................................................................................... manage-discount-codes › AdminController@manageDiscountCodes
  GET|HEAD   root/manage-peyks .............................................................................................................. manage-peyks › AdminController@managePeyks
  GET|HEAD   root/manage-receives-times ..................................................................................... manage-receive-times › AdminController@manageReceivesTimes
  GET|HEAD   root/manage-services ..................................................................................................... manage-services › AdminController@manageServices
  GET|HEAD   root/manage-tarikhs ........................................................................................................ manage-tarikhs › AdminController@manageTarikhs
  GET|HEAD   root/orders ............................................................................................................................... orders › AdminController@orders
  GET|HEAD   root/sync-categories-services ........................................................................... sync-categories-services › AdminController@syncCategoriesServices
  GET|HEAD   root/users .................................................................................................................................. users › AdminController@users
  GET|HEAD   sanctum/csrf-cookie ........................................................................................................... Laravel\Sanctum › CsrfCookieController@show
  GET|HEAD   sms .......................................................................................................................................................................

                                                                                                                                                                     Showing [59] routes

0 Answers
Related