Jump to content

Recommended Posts

I have the below php in my 404.php in wordpress. Recently we moved our main site url to wordpress from IIS. Company name is important.

I want to treat any url that contains \prtaxsvc to not change from POST to GET as I need to run a WCF .svc file on the old server which runs IIS ( cant run a .svc on wordpress hosted site ) 

any clue on how to make this work. I think I need to make \prtaxsvc report as 308 or 307 and leave other old calls as 301. Right now it fails to send .svc to old server..

thanks

get_header();
?>
<?php
header("HTTP/1.1 301 Moved Permanently");

header("Location: http://www.mysite.com{$_SERVER['REQUEST_URI']}"); 

exit();

?>

Share this post


Link to post
Share on other sites

There is no mechanism in HTTP to tell a client that it should submit POST requests to a new URL.

The industry handles this in a fairly standard way: deprecate the old endpoint before taking it down. Continue supporting it for some period of time and give a warning to consumers that it will move.

Share this post


Link to post
Share on other sites

301 Moved Permanently: The resource has been permanently moved and request method conversion from POST to GET is allowed.

307 Temporary Redirect: The resource has been temporarily moved and request method conversion from POST to GET is forbidden.

302 Found: The resource has been temporarily moved and request method conversion from POST to GET is allowed.

Share this post


Link to post
Share on other sites

Are you using someone's blog as your reference?

https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.8

Quote

If the 307 status code is received in response to a request other than GET or HEAD, the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued.

 

Share this post


Link to post
Share on other sites

I am just trying to get this to work. Our company has a dll embedded in its code that calls/called the .svc on our web server. Did not know that forwarding the POST would cause it to not function. torture.

Share this post


Link to post
Share on other sites

So do what I said: deprecate the old endpoint, but keep it working until the DLL can be updated. Ideally you would keep everything working instead of redirecting because there are other nuances to consider, but at a minimum keep the non-GET/HEADs up.

If it's something distributed to customers then you'll have to keep this going for however long you support your software. If it's something internal then, you know, update the DLL.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.