ALL possible issues of 404 NOT found laravel 6 - mysql

I've been stuck in a weird problem for a couple of days. All my web application routes are working fine except one. Its has a 404 not found issue. So I checked:
My Routes list. It exists.
| | GET|HEAD | dashboard/profile/create | profile.create | App\Http\Controllers\Dashboard\ProfileController#create | web
URI in Routes list & Request URL in search box matches.
Request URL: http://localhost/CMSsk/CMS/public/dashboard/profile/create
Checked my blade Layout. No Problems.
<i class="fas fa-briefcase fa-2x mr-2"></i>Add Credentials
Cheked Controller. It exists.
public function create()
{
$user = Auth::user();
return view('Dashboard.Profile.profile-create',compact('user'));
}
Cheked Apache2 Rewrite module (Enabled) & Override ALL.
Used PHPUnit & Chrome Browser devtools to check networks,console,Apllication Cookies,storage. Can't find any issues other than 404.
Used PHPUnit testing and XDebug,dd() to trace problem. The Code doesn't reach Controller method.
Checked ALL possible Stack Overflow issues. Did not solve the problem.
Cleared browser Cache.
Did:
php artisan route:cache
Q: What are other possible issues that I might not have checked to solve this simple yet complicated issue?
Note: I referenced the form Page from another page which has a Social Media Sharing 3rd party Plugin Installed(AddThis). Hence I tried other form pages & other links from there and it works. So I'm confused why Only one page has issue(I thought the Plugin may have effect).

Update:
I fixed the Solution but I wanted to share how I did just so that anyone who stumbles upon this scenario finds some help.So here it goes:
Solution:
I created a Route group first which had the prefix named profile. It had 19 routes. Immediately after that I Created a Resource Route which had it's name prefix. So the two Identical names had a conflict for which I was not getting the page.
How I figured out:
I almost ran out of all possible solutions. So I started Manually testing the routes just to figure out if there's a pattern developing. I know it's not the most effective way but I wanted to figure out a pattern that's why I did it. After testing the Route group prefix named profile I figured out that all routes inside this group are NOT working from where I called it. Then I tested Routes outside that group from that specific blade view and it was working. So I changed the name of the Resource Route just to make it distinct from the Route group prefix. And it worked!

Related

Angularfire2 valueChanges() returns data after I deleted it manually in Firebase

I am querying a subcollection in Firestore in an Angular6 Web App. On the first run, my function went through, but I was missing some information, so I had to delete it. I deleted the data in the subcollection manually in Firebase.
This is my query:
this.inviteSub = this.afs.collection('groups').doc(myGroup).collection<any>('invitations').valueChanges().subscribe(invites => {
console.log(invites);
});
When I execute my function on the client (Chrome) again, the valueChanges returns me the data that actually has been deleted.
I already tried a hard refresh by CTRL+F5 of the website. I also closed the browser. I also tried to unsubscribe when I at ngOnDestroy. But none of my efforts "cleared" up my 'invites'.
Can anyone help me how I "refresh" my browser / function / 'invites'?
UPDATE:
I still could not figure out what the issue causes, but I changed my App to Angular 6. So, I also changed this in my question.
I found a solution by myself. In my 'app.module.ts' I had the persistence enabled AngularFirestoreModule.enablePersistence() and changed it to AngularFirestoreModule

Error: The requested URL “[no URL]”, is invalid

Originally posted as a reply to: Error: The requested URL "[no URL]", is invalid
I get this error but only with one specific website (which is my own). This must be linked to the website as it is happening on 3 different machines on 3 different networks (personal comp on personal wifi, phone on 4/3g and work pc on work network) and no other sites. Also, it happens no matter what you put after the domain name, weather its a real page or just '/sdjhlgajhsdfg'.
A reply to the other post said that it looks like somthing to do with akamai. As this is my site, i went to the CPanel and disabled the akamai options (over 24 hours ago). i do not need any kind of caching like this as it is a simple html css site with only a hand full of mostly text pages. The most complicated thing on the site is a downloadable pdf which i have actually just taken down.
The error ref number changes every time you refresh the page.
Reference #9.d7c33b8.1478565760.55ccef1
Reference #9.d7c33b8.1478566986.560a7c3
Reference #9.d7c33b8.1478567000.560b460
Any advice would be very much appreciated.
I finally found some time to contact my webserver provider.
I can see that the domain has been removed from the Akamai server.
However, the CNAME which was pointing to Akamai server was causing the
issue. I have removed the CNAME record.
after about half an hour its back up. theres some display issues with the layout, but at lease its displaying the relevant content and not the error.
When you see Invalid URL error, this indicates that the hostname (domain) is not recognized by the Akamai's network (production or staging).
More info at: https://control.akamai.com/search/kb/11327
Hope this helps.
If there is a reverse proxy in before akamai you may get this error.
Client > Reverse Proxy > Akamai > Your API, will give this error.
Let your reverse proxy strip "Host" header and sent by "Client" and try again.
That worked for me in a setup like this:
Browser > Caddy Server > Akamai > My API
in akamai i had to add a new property manager entry for the new url/cert then activate it in prod.

CakePHP 3 Post Method '403 Forbidden'

I came across a really strange issue today and couldn't find any solution. I am using CakePHP 3 along with MySQL and Apache. Everything was working perfect until today but when I tried to edit one of the forum post, it didn't save and I got 403 Forbidden response. Following is the response I got:
Request URL:https://www.example.com/users/edit/2
Request Method: POST
Status Code:403 Forbidden
The strange part is that it is working fine when I try to create new forum post as well as for GET request when I load the edit page. But when I modify the fields and try to save, I get stuck with 403 Forbidden.
I tried every mean in last 6 hours but could not find any solution. I checked database user for edit permissions, tried to remove .htaccess file completely, cleared browser cache and cookies but nothing helped at all. The other websites in hosting account are working fine and there is no issue with them.
The only notable thing I did today is I initialized GIT repository and uploaded project files on git. I would really appreciate your help in solving this issue. It is really a constant headache not to be able to modify anything.
Just for the future reference, I solved this issue by explicitly defining request type to POST in $this->Form->create function.
It was one of the strangest error I came across while using CakePHP 3! Not sure why default PUT method was not working. It was converting to GET.
Huh, finally i found the culprit itself by my own.. This is the explanation that i got, here you go:
If you are using csrf for security in cakephp you might found that every damn POST,GET,PUT in ajax or form will be filtered by cakephp and if not auth found cakephp will respond with 403 HTTP Status..
That mean you have to put some csrf token that like a bearer token on every your request so the cakephp recognize that request. See, if you are using AJAX call so you have to put csrf token manually explained here : https://book.cakephp.org/3.0/en/controllers/components/csrf.html
If you created a form manually you have to put the token inside the form itself, if you creating a form using cakephp helper you will see that cakephp generated some hidden parameter like this one
<form enctype="multipart/form-data" method="post" accept-charset="utf-8" action="/SFW/CMS/event/comment">
<div style="display:none;">
<input type="hidden" name="_method" value="POST">
<input type="hidden" name="_csrfToken" autocomplete="off" value="2a39630d2a1c20d43xxxx">
</div>
......
So the option is only put those hidden field on your manually generated form.
Good luck
If you don't care about security you can disable the middleware check in your controller:
public function beforeFilter(Event $event)
{
$this->getEventManager()->off($this->Csrf);
}
Reference:
https://book.cakephp.org/3/en/controllers/components/csrf.html

503 (Service Unavailable) when trying to Create File to Google Drive

We've been getting a 503 error since yesterday when making this call:
result = session.execute(
api_method: drive.files.insert,
body_object: file,
media: media,
parameters: {'uploadType' => 'multipart', 'alt' => 'json'}
)
We have 3 set of keys - one each for our development, staging, and production environments.
The above call works without issue in our development environment, but fails 100% of the time in both staging and production environments
Based on the gists shared privately, it looks like the issue is the user agent header. I was able to reproduce by setting the UA similar to that one. I haven't been able to narrow it down to a particular issue with the UA, just that it doesn't work. Other multi-line strings work, and other chars seem fine if I replace the newlines.
Anyway, easiest thing to do is set :application_name with a different value that what you're using now.

Problems with MediaWiki's AccessControl extension

I've installed the AccessControl MediaWiki extension however it seems like it causes an access denied error if you search for anything even contained within the page that is access controlled.
Anyone using this extension?
All I want to do is hide one page in the wiki from everyone except for 5 people.
MediaWiki version 1.18.0
AccessControl version 2.1
I solved it by adding another namespace to put the pages I need to secure in. I then removed the namespace from being searchable by implementing the searchablenamespaces hook.
By doing this, there will never be an access denied page displayed just by searching for text that happens to be in an access controlled page.
Here is the code for $IP/extensions/NoSearchNameSpace/NoSearchNameSpace.php
<?php
// This is a quick hack to remove certain listed namespaces from being searchable
// Just set a list of namespace IDs in the wgNoSearchNamespaces array in LocalSettings
// ie $wgNoSearchNamespaces = array(500,501) would remove 500 and 501 from being searched
$wgHooks['SearchableNamespaces'][] = 'noSearchNameSpace';
function noSearchNameSpace($arr){
global $wgNoSearchNamespaces;
foreach($wgNoSearchNamespaces as $ns){
unset($arr[$ns]);
}
return $arr;
}
Example LocalSettings.php entry:
// Add two custom namespaces. One for ACL pages.
// one for pages that will be ACL'd that should not be searched.
$wgExtraNamespaces[500] = "ACL";
$wgExtraNamespaces[501] = "NoSearch";
// Include the NoSearchNamespace extension
require_once("extensions/NoSearchNamespace/NoSearchNameSpace.php");
$wgNoSearchNamespaces = array('500','501');
I tried it with 1.20.2, and had the problem when a page I was searching for contained text being searched, putting it in the list of search results, which provoked an error because the "hookUserCan" function in AccessControl.php didn't return a value. To try to fix this, I modified line 341 of AccessControl.php ("return doRedirect( 'accesscontrol-info-anonymous' );" to "return false;". This forces the search results to return just the title of the page, and then gets a permission error if an unauthorized user tries to open it. This is not a perfect fix, but it is sufficient for my purposes.
Editted, this is a better answer:
I made some modifications to the AccessControl.php program, and now it appears to work ok with MediaWiki user groups. A remaining problem is that the TITLES of protected pages show in the search results. This is fixable in the main MediaWiki source code (SpecialSearch.php, around line 562), but according to comments in that code, it would screw up the paging.
Here is my git directory, which can be unzipped to $IP/extensions/AccessControl:
https://ejc.s3.amazonaws.com/AccessControlGit.zip
Here is just the AccessControl.php file: http://pastebin.com/WnyB6gBw
Note that this has only been tested (briefly) with MediaWiki 1.20.2. I'm hoping that the author of the extension will review what I did and fix whatever problems remain.
I fixed this error by adding
return false;
after ALL LINES that say
doRedirect( 'accesscontrol-info-anonymous' );