Question

I'm am calling a REST Flask server from an AngularJs client. In one call, one of my ids (key) can contain a forward slash

If not, the call works fine. If there's a slash, I receive a 404 not found error

I've tried to encode the key (encodeURIComponent), escape the key (escape)... but still have a 404 error.

My code in flask

@app.route('/user/<string:uid>/subuser/<string:subuser>/key/<string:key>', methods=['DELETE'])
def deleteSubuserKey(uid, subuser, key):
    Log.err("deleteSubuserKey")
    return ...

My code in AngularJS

$scope.uri = ctrlURL+"S3/user/"+user_id+"/subuser/"+subuser+"/key/"+key;
$http({method: "delete", url: $scope.uri }).
     success(function (data, status) {
                ...
            }).
     error(function (data, status) {
                ...
            });

Does anyone have an idea?

Was it helpful?

Solution

Thanks to Brian's comment, I solved my issue. My call was rejected directly by Apache when the slash was encoded.

I've added AllowEncodedSlashes Directive in my apache conf:

AllowEncodedSlashes NoDecode

With the key encoded with :

encodeURIComponent(key)

It works.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top