I want my Laravel to use Client side Nuxt JS and use Laravel as backend admin-panel and api(s).
This is my code to proxy Laravel project to Nuxt JS but it’s not properly working.
<VirtualHost *:80>
ServerName nuxt.local
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/nuxt/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyPassMatch /^(admin-panel)(.*)$ !
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
ProxyPreserveHost on
LogLevel debug
</VirtualHost>
I want to exclude “admin-panel” and “api” routes from hitting the proxy.
3
Answers
I have solved the problem
I am posting my apache2 config code. Might be this can be helpful for any.
and in laravel routes/web.php file write the
to use project URL not proxy URL
httpd.conf
inside your apache directory. Then, make an original copy and keep it.Make the changes, however you wish. You might want to make sure, this is correct before you add:
Maybe, you want something like this:
After each changes in
httpd.conf
, you might want to restart apache and test to see if it would work.Instead of using the
ProxyPassMatch
directive try just excluding each url from your proxy pass:There is probably a way to combine them into one line with regular expression as well, something like:
ProxyPass ^/(admin-panel|api)(.*)$ !