Floydascc81 Posted July 30, 2020 Share Posted July 30, 2020 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(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/311243-request_uri/ Share on other sites More sharing options...
Floydascc81 Posted July 30, 2020 Author Share Posted July 30, 2020 /prtaxsvc Quote Link to comment https://forums.phpfreaks.com/topic/311243-request_uri/#findComment-1580169 Share on other sites More sharing options...
requinix Posted July 30, 2020 Share Posted July 30, 2020 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. Quote Link to comment https://forums.phpfreaks.com/topic/311243-request_uri/#findComment-1580175 Share on other sites More sharing options...
Floydascc81 Posted July 30, 2020 Author Share Posted July 30, 2020 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. Quote Link to comment https://forums.phpfreaks.com/topic/311243-request_uri/#findComment-1580180 Share on other sites More sharing options...
Floydascc81 Posted July 30, 2020 Author Share Posted July 30, 2020 https://airbrake.io/blog/http-errors/308-permanent-redirect Quote Link to comment https://forums.phpfreaks.com/topic/311243-request_uri/#findComment-1580181 Share on other sites More sharing options...
requinix Posted July 30, 2020 Share Posted July 30, 2020 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. Quote Link to comment https://forums.phpfreaks.com/topic/311243-request_uri/#findComment-1580183 Share on other sites More sharing options...
Floydascc81 Posted July 30, 2020 Author Share Posted July 30, 2020 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. Quote Link to comment https://forums.phpfreaks.com/topic/311243-request_uri/#findComment-1580184 Share on other sites More sharing options...
requinix Posted July 30, 2020 Share Posted July 30, 2020 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. Quote Link to comment https://forums.phpfreaks.com/topic/311243-request_uri/#findComment-1580185 Share on other sites More sharing options...
Floydascc81 Posted August 7, 2020 Author Share Posted August 7, 2020 I know you said give up.. but can't i somehow make any attempt to get to a file do something like this? I have it in my redirects and for the GETS it does it. Why doesn't the POST folow the same rule? http://www.accountmate.com/prtaxsvc/services.svc go to https://accountmateportal.com/download/PRDownloaddll2020.asp Quote Link to comment https://forums.phpfreaks.com/topic/311243-request_uri/#findComment-1580443 Share on other sites More sharing options...
requinix Posted August 7, 2020 Share Posted August 7, 2020 POSTs don't follow the same rule because POSTs don't follow the same rule. It's written into the standards, and with the comment that the user might not want the site to redirect their data somewhere else. And I didn't say to give up. I said that you cannot automatically redirect like this so you have to do something else - such as support the old POST endpoints until you can be reasonably sure that all consumers have been updated to go to the new site. Quote Link to comment https://forums.phpfreaks.com/topic/311243-request_uri/#findComment-1580445 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.