Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
401 views
in Technique[技术] by (71.8m points)

node.js - 501 on PUT request

We have a UI code that calls our backend to do a GET and PUT using https protocol. (i.e. GET /api/data and PUT /api/data) On the backend side, we have handlers defined for both GET and PUT for this path. Somehow GET works fine, but for PUT we are getting 501 back.

One thing to note is that we did set Akamai for this app. Before, the Akamai, I think it was working fine when UI was talking directly using the host. But now using this public host from Akamai, PUT doesn't seem to work as it did before.

Initially, I saw this: enter image description here

And decided to add this: res.setHeader('Referrer-Policy', 'same-origin');

Now I am seeing this: enter image description here

Any idea what might be going on or what I might need to set so that both GET and PUT works?

question from:https://stackoverflow.com/questions/65943418/501-on-put-request

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I had a similar issue before. Most likely you have a Web.Config or something similar that is blocking PUT requests.

For example in some PHP based backends in Azure I had to add: (there was only GET, POST and therefore the other requests were blocked)

<handlers>
  <add name="PHP73_via_FastCGI" path="*.php" verb="GET, PUT, POST, DELETE, HEAD" modules="FastCgiModule" scriptProcessor="D:Program Files (x86)PHPv7.3php-cgi.exe" resourceType="Either" requireAccess="Script" />
</handlers>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...