Cross-orgin with laravel and vuejs

1

In my dilemma to publish my application I am facing some problems.

I'm making the front separated from the back. The frontend is in vuejs and the backend in Laravel (being only an API)

On the server it looks like this:

public_html
      index.html
      static
      api
         app
         database
         config
         ....
         public
            .htaccess

Since index.html and static are from vuejs and within api are all Laravel files. In my htaccess it looks like this:

<IfModule mod_rewrite.c>
      RewriteEngine On
      Header set Access-Control-Allow-Origin "*"
      Header set Access-Control-Allow-Headers "Content-Type"
      Header set Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"
</IfModule>

When my domain.com requests for api.mydomain.com I get the cross-origin error. How to solve this?

  • I did not move in any other laravel file. I just added the htacess in the API public. I do not know if you have any extra configuration to do.
asked by anonymous 20.03.2018 / 16:43

0 answers