AJAX post performs action but returns 403 Forbidden












0















In a Laravel project, I am making AJAX requests like below. It has worked on a lot of different computers and different networks, but for a specific company, it doesn't.



The requests are actually performed as they should, BUT they return 403 Forbidden. The "only problem" is therefore the error code. If they would just return with a success message, everything would be great.



Any suggestions on what's wrong? Can I do something do fix it, or does the customer maybe need to open up for something? They have told me, that they have a high level of security, but I can't see why their security should block this, when it actually performs the actions.



Alternatively, if I can do something hacky to just ignore the 403 (but still handle other error codes) and continue to 'done', it would be great tempoary.



// General AJAX header
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});

// Request
var formData = new FormData(curr[0]);
$.ajax({
type: 'POST',
contentType: false,
url: '/company/teams',
data: formData,
processData: false
})
.fail(function(jqXHR, textStatus) {
// Errors
})
.done(function(data) {
// Success
});









share|improve this question























  • have you defined default document for directories? Does /company/teams points to /company/teams/index.php or something similar?

    – Ali Sheikhpour
    Nov 21 '18 at 15:31













  • Need to find out why it is forbidden. That is typically an authorization issue. Ignoring it wouldn't make much sense

    – charlietfl
    Nov 21 '18 at 15:34













  • It's all handled by Laravels routing - how it works beneath, I don't know. But it acceses the controller function correctly and performs it - instead of returning a success message, it gives a 403 - but only for one company.

    – Christian Bundgaard
    Nov 21 '18 at 15:35











  • This looks like a .htaccess issue to me. Are any other routes working as expected?

    – Peter
    Nov 21 '18 at 20:31











  • Everything works as expected - even here. The only problem is, that it returns a 403 Forbidden, even though the actions doesn't get blocked - it is actually performed. And it is only for one particular company, that the problem occurs.

    – Christian Bundgaard
    Nov 21 '18 at 20:32
















0















In a Laravel project, I am making AJAX requests like below. It has worked on a lot of different computers and different networks, but for a specific company, it doesn't.



The requests are actually performed as they should, BUT they return 403 Forbidden. The "only problem" is therefore the error code. If they would just return with a success message, everything would be great.



Any suggestions on what's wrong? Can I do something do fix it, or does the customer maybe need to open up for something? They have told me, that they have a high level of security, but I can't see why their security should block this, when it actually performs the actions.



Alternatively, if I can do something hacky to just ignore the 403 (but still handle other error codes) and continue to 'done', it would be great tempoary.



// General AJAX header
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});

// Request
var formData = new FormData(curr[0]);
$.ajax({
type: 'POST',
contentType: false,
url: '/company/teams',
data: formData,
processData: false
})
.fail(function(jqXHR, textStatus) {
// Errors
})
.done(function(data) {
// Success
});









share|improve this question























  • have you defined default document for directories? Does /company/teams points to /company/teams/index.php or something similar?

    – Ali Sheikhpour
    Nov 21 '18 at 15:31













  • Need to find out why it is forbidden. That is typically an authorization issue. Ignoring it wouldn't make much sense

    – charlietfl
    Nov 21 '18 at 15:34













  • It's all handled by Laravels routing - how it works beneath, I don't know. But it acceses the controller function correctly and performs it - instead of returning a success message, it gives a 403 - but only for one company.

    – Christian Bundgaard
    Nov 21 '18 at 15:35











  • This looks like a .htaccess issue to me. Are any other routes working as expected?

    – Peter
    Nov 21 '18 at 20:31











  • Everything works as expected - even here. The only problem is, that it returns a 403 Forbidden, even though the actions doesn't get blocked - it is actually performed. And it is only for one particular company, that the problem occurs.

    – Christian Bundgaard
    Nov 21 '18 at 20:32














0












0








0








In a Laravel project, I am making AJAX requests like below. It has worked on a lot of different computers and different networks, but for a specific company, it doesn't.



The requests are actually performed as they should, BUT they return 403 Forbidden. The "only problem" is therefore the error code. If they would just return with a success message, everything would be great.



Any suggestions on what's wrong? Can I do something do fix it, or does the customer maybe need to open up for something? They have told me, that they have a high level of security, but I can't see why their security should block this, when it actually performs the actions.



Alternatively, if I can do something hacky to just ignore the 403 (but still handle other error codes) and continue to 'done', it would be great tempoary.



// General AJAX header
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});

// Request
var formData = new FormData(curr[0]);
$.ajax({
type: 'POST',
contentType: false,
url: '/company/teams',
data: formData,
processData: false
})
.fail(function(jqXHR, textStatus) {
// Errors
})
.done(function(data) {
// Success
});









share|improve this question














In a Laravel project, I am making AJAX requests like below. It has worked on a lot of different computers and different networks, but for a specific company, it doesn't.



The requests are actually performed as they should, BUT they return 403 Forbidden. The "only problem" is therefore the error code. If they would just return with a success message, everything would be great.



Any suggestions on what's wrong? Can I do something do fix it, or does the customer maybe need to open up for something? They have told me, that they have a high level of security, but I can't see why their security should block this, when it actually performs the actions.



Alternatively, if I can do something hacky to just ignore the 403 (but still handle other error codes) and continue to 'done', it would be great tempoary.



// General AJAX header
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});

// Request
var formData = new FormData(curr[0]);
$.ajax({
type: 'POST',
contentType: false,
url: '/company/teams',
data: formData,
processData: false
})
.fail(function(jqXHR, textStatus) {
// Errors
})
.done(function(data) {
// Success
});






jquery ajax laravel http-status-code-403






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 21 '18 at 15:28









Christian BundgaardChristian Bundgaard

8510




8510













  • have you defined default document for directories? Does /company/teams points to /company/teams/index.php or something similar?

    – Ali Sheikhpour
    Nov 21 '18 at 15:31













  • Need to find out why it is forbidden. That is typically an authorization issue. Ignoring it wouldn't make much sense

    – charlietfl
    Nov 21 '18 at 15:34













  • It's all handled by Laravels routing - how it works beneath, I don't know. But it acceses the controller function correctly and performs it - instead of returning a success message, it gives a 403 - but only for one company.

    – Christian Bundgaard
    Nov 21 '18 at 15:35











  • This looks like a .htaccess issue to me. Are any other routes working as expected?

    – Peter
    Nov 21 '18 at 20:31











  • Everything works as expected - even here. The only problem is, that it returns a 403 Forbidden, even though the actions doesn't get blocked - it is actually performed. And it is only for one particular company, that the problem occurs.

    – Christian Bundgaard
    Nov 21 '18 at 20:32



















  • have you defined default document for directories? Does /company/teams points to /company/teams/index.php or something similar?

    – Ali Sheikhpour
    Nov 21 '18 at 15:31













  • Need to find out why it is forbidden. That is typically an authorization issue. Ignoring it wouldn't make much sense

    – charlietfl
    Nov 21 '18 at 15:34













  • It's all handled by Laravels routing - how it works beneath, I don't know. But it acceses the controller function correctly and performs it - instead of returning a success message, it gives a 403 - but only for one company.

    – Christian Bundgaard
    Nov 21 '18 at 15:35











  • This looks like a .htaccess issue to me. Are any other routes working as expected?

    – Peter
    Nov 21 '18 at 20:31











  • Everything works as expected - even here. The only problem is, that it returns a 403 Forbidden, even though the actions doesn't get blocked - it is actually performed. And it is only for one particular company, that the problem occurs.

    – Christian Bundgaard
    Nov 21 '18 at 20:32

















have you defined default document for directories? Does /company/teams points to /company/teams/index.php or something similar?

– Ali Sheikhpour
Nov 21 '18 at 15:31







have you defined default document for directories? Does /company/teams points to /company/teams/index.php or something similar?

– Ali Sheikhpour
Nov 21 '18 at 15:31















Need to find out why it is forbidden. That is typically an authorization issue. Ignoring it wouldn't make much sense

– charlietfl
Nov 21 '18 at 15:34







Need to find out why it is forbidden. That is typically an authorization issue. Ignoring it wouldn't make much sense

– charlietfl
Nov 21 '18 at 15:34















It's all handled by Laravels routing - how it works beneath, I don't know. But it acceses the controller function correctly and performs it - instead of returning a success message, it gives a 403 - but only for one company.

– Christian Bundgaard
Nov 21 '18 at 15:35





It's all handled by Laravels routing - how it works beneath, I don't know. But it acceses the controller function correctly and performs it - instead of returning a success message, it gives a 403 - but only for one company.

– Christian Bundgaard
Nov 21 '18 at 15:35













This looks like a .htaccess issue to me. Are any other routes working as expected?

– Peter
Nov 21 '18 at 20:31





This looks like a .htaccess issue to me. Are any other routes working as expected?

– Peter
Nov 21 '18 at 20:31













Everything works as expected - even here. The only problem is, that it returns a 403 Forbidden, even though the actions doesn't get blocked - it is actually performed. And it is only for one particular company, that the problem occurs.

– Christian Bundgaard
Nov 21 '18 at 20:32





Everything works as expected - even here. The only problem is, that it returns a 403 Forbidden, even though the actions doesn't get blocked - it is actually performed. And it is only for one particular company, that the problem occurs.

– Christian Bundgaard
Nov 21 '18 at 20:32












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53415348%2fajax-post-performs-action-but-returns-403-forbidden%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53415348%2fajax-post-performs-action-but-returns-403-forbidden%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

"Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

Alcedinidae

RAC Tourist Trophy