Laravel nova v3.12 after user authenticated is giving 403 Forbidden - http-status-code-403

I have cloned a project on same server...
App1: tekmab.com.br
Folder: /home/tekmab/webapps/tekmab
App2: demo.tekmab.com.br
Folder: /home/demo/webapps/tekmab-demo
App2 is for test purposes before send it to production (app1)
App2 is working fine. But app1, works only until nova auth page. After user auth, it redirects to the default 403 page.
Looking on server logs, don't have any line about this recent 403.
So, I don't know what to do next.
I'm using Laravel 7 and nova v3.12 with nginx
Everything works outside nova... and with nova until the auth page. Just go to 403 with authenticated users. And this does not generate any 403 entry on the server logs (or any other entry)

in order for it to work in production, you need to add your email in the gate method at NovaServiceProvider
after that try to clear config.
it should work.

Related

Laravel Deployment all routes except / show 404

TLDR
I'm deploying a Laravel application to Directadmin with deployer's recipe. Getting 404 on all routes except /.
What I've tried
Manual Deploy
Initially I created the storage link Laravel requires between app/storage/public and public/storage
ln -sfn /home/myuser/domains/example.com/laravel/storage/app/public/ /home/myuser/domains/example.com/laravel/public/storage
For security I've placed the source files outside of public_html and created symlinks for the contents of public into public_html
/home/myuser/domains/example.com/laravel/
ln -s home/myuser/domains/example.com/laravel/public/* home/myuser/domains/example.com/public_html/
This kept leading me to all sorts of crazy errors during runtime like Whitescreens and route issues even though the deployment cleared cache and routes and followed Laravel deployment steps.
Deployer Script
Switched to Deployer's Laravel recipe and symlinked the each file and folder in current to public_html so I can have subdomains on the same domain. This worked the first 2 deployments round after some coaxing with permissions.
Then had route cache issues causing a symphony closure error. Which I solved by clearing routes and restarting the httpd server.
Next deployment all routes except / show 404.
What I've done this deployment
Reset permissions
npm run prod
php artisan route:clear
php artisan cache:clear
Checked .htaccess
restart httpd
Read most questions on Stackoverflow on 404's and routes [1] [2] which suggest clearing route cache and checking order of routes and typo's in route files.
One thing to note I'm deploying code that works in Dev on Linux PHP8. So there's no issues with the routes files. Deploying to the same Linux distro and same version of PHP.
Most of these steps are part of the deployment script anyway. But somehow Laravel finds a way to break on each deployment (even when it's scripted). Laravel is so temperamental!!
Anyone have an idea what else could be wrong?
[404 Routes Question][1]
[Another 404 Routes question with htaccess][2]
[Laravel Api routes does not work][3]
[1]: https://stackoverflow.com/questions/14160202/laravel-debugging-404-routes
[2]: https://stackoverflow.com/questions/24147460/laravel-all-routes-except-return-404
[3]: https://stackoverflow.com/questions/57400525/laravel-api-routes-doesnt-works-404

NodeJS cPanel Hosting

I set up a NodeJS API on cPanel using the NodeJS setup that is provided. the app starts but none of my endpoints are reachable with 404 pages being displayed.
In the cPanel > metrics > errors I can see the error: Path for NodeJS application is invalid: /home/username/repositories/repo
where username is the cpanel username and repo is the server.
I used the built in git support in cPanel to link to a remote repo via SSH. This part is most likely not the problem since I can see the actual server files referenced in the NodeJS server with the correct path (which is why this error message is so strange.)
The server works fine on localhost so this likely has something to do with cPanel.
I have never hosted a node app on cPanel and I know a VPS would be better but this is what I have to work with for now. There isn't a lot of discussions/forums/docs on this online so I am running out of options.
I would highly appreciate it if someone can tell me what is wrong or guide me in the right direction for where to start looking for the problem.
I solved the problem. When you don't use a git repo you can use a relative path from your home to the place the server is stored. i.e. don't include home/username/ in the path
for git repos you must use the absolute path meaning
home/username/repositories/yourserver
where "username" is your cPanel username and "yourserver" is the name of the folder where your server is located

Only seeing Index of/ at domain even though index.js is present in the pubic_html directory

I've been driving myself a little mad trying to deploy this node.js and express app
I'm hosting on bluehost, so therefor, deploying via cpanel -
Currently:
Git repo cloned and deployed head commit success
Node app registered in app manager and Npm dependencies have been successfully ensured.
I after cd'ing into my repository directory in cpanel terminal I ran
/opt/cpanel/ea-nodejs10/bin/node app.js
and it was confirmed that
Server running at http://127.0.0.1:3000
Then after logging into whm root I ran
curl http://127.0.0.1:3000
And am returned with my index.ejs file , which seems like a good sign.
However, when I go to my domain -- deltadesigns.co
All you can see is :
Index of /
Name Last modified Size Description
DeltaDesigns22/ 2021-02-27 06:23 -
cgi-bin/ 2021-02-19 03:00 -
DeltaDesigns22 is the repo with all of required files and folders, public, views, app.js cpanel.yml etc.
I can't figure out why it's not working, feel like I'm so close but am just missing something! All help is appreciated!

Heroku deployment issue with Zero to Mastery final project "smart-brain"

So I am finishing up a full stack project that was deployed in heroku and connected through github for automatic deployment. The front-end works fine but I am receiving errors both on heroku and the developer tools for Chrome when registering users. The back-end worked fine locally but after deployment I am now receiving an "application error" page. On chrome it kicks out:
Access to fetch at 'https://facial-recognition-machine.herokuapp.com/register' from origin 'https://facerecognitionbrain-sk.herokuapp.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled."
On heroku cli after using "heroku logs -a"
Heroku CLI Error
These are the repositories on my github of the front end and back end for reference.
Front End
Back End
I'm relatively knew to this so thank you in advance for any and all help.
Update: I figured it out from heroku's deployment documentation of Node.js.
I needed a .gitignore file that contained
/node_modules
npm-debug.log
.DS_Store
/*.env
It was also suggested to delete the node_modules and npm install again.

How to deploy shield with Kibana on Bluemix

I am trying to deploy Kibana on Bluemix PaaS. Because Kibana is a Node.js application, it can be deployed as such on Bluemix. All i have to do:
Provide a simple manifest.yml file that details the app name and a couple of other things
Provide a Procfile that has just one line as web: bin/kibana --port=$PORT
Thus, I can run Kibana on Bluemix. Note that this is pushed via Cloud Foundry.
Also, I was able to install the marvel and sense plugins for Kibana.
Now, I installed the shield plugin. This plugin requires an ssl key and an ssl cert file to run. The path to these files must be provided in the kibana.yml file.
After installation, I tested the shield plugin natively and it worked just fine.
Here is the layout of the directory structure:
bin(d)
config(d)
installedPlugins(d)
node_modules(d)
sslFiles(d)
manifest.yml
Procfile
(d) represents directories. The sslFiles folder contains the ssl key and ssl cert files.
Before I could push to Bluemix, I knew that the paths to the SSL files would have to be relative to the app in Bluemix. Thus, in the kibana.yml file, I specified them as:
kibana.ssl.key:app/sslFiles/kibana.key
kibana.ssl.cert:app/sslFiles/kibana.cert
I did this as in Bluemix, I could see the following directory structure:
app(d)
bin(d)
config(d)
installedPlugins(d)
node_modules(d)
sslFiles(d)
manifest.yml
Procfile
Indentation represents containment. So, I pushed it to Bluemi using Cloud Foundry, but now I get a 502 Bad Gateway: Registered endpoint failed to handle the request error. I tried changing the paths to sslFiles/kibana.key but then I got a cannot find path sslFiles/kibana.key staging error.
What is responsible for my 502 error? Is it the path to the sslFiles? If so, how can I properly provide the paths?

Resources