My local setup for WordPress is at http://127.0.0.3/blog
.
When calling /blog/wp-login.php
, I get the page served; including Google CAPTCHA. But the login post to a 302
redirect to http://127.0.0.3/blog
.
In order to overwrite my server default domain I added locally this to my wp-config.php
file:
define('WP_HOME','http://127.0.0.3/blog');
define('WP_SITEURL','http://127.0.0.3/blog');
define('FORCE_SSL_LOGIN',false);
define('FORCE_SSL_ADMIN',false);
In my Fiddler Web Debugger script I am using the following code to redirect my browser to go to my local setup:
if (oSession.HostnameIs("my.domain.name")){
oSession.bypassGateway = true;
if (oSession.HTTPMethodIs("CONNECT")){
oSession["x-replywithtunnel"] = "FakeTunnel";
return;
}
oSession["x-overrideHost"] = "127.0.0.3";
oSession.fullUrl = "http://127.0.0.3" + oSession.PathAndQuery;
}
How can I get WordPress returned page to be rewritten before it gets sent to the browser, so it changes all 127.0.0.3
to my.domain.name
?
-- OR --
Is there a smarter way to go about all of this within WordPress?
I had a look at Change WordPress image URLs via filter because it is somewhat related, but could not figure it out.
My local setup for WordPress is at http://127.0.0.3/blog
.
When calling https://my.domain.name/blog/wp-login.php
, I get the page served; including Google CAPTCHA. But the login post to a 302
redirect to http://127.0.0.3/blog
.
In order to overwrite my server default domain I added locally this to my wp-config.php
file:
define('WP_HOME','http://127.0.0.3/blog');
define('WP_SITEURL','http://127.0.0.3/blog');
define('FORCE_SSL_LOGIN',false);
define('FORCE_SSL_ADMIN',false);
In my Fiddler Web Debugger script I am using the following code to redirect my browser to go to my local setup:
if (oSession.HostnameIs("my.domain.name")){
oSession.bypassGateway = true;
if (oSession.HTTPMethodIs("CONNECT")){
oSession["x-replywithtunnel"] = "FakeTunnel";
return;
}
oSession["x-overrideHost"] = "127.0.0.3";
oSession.fullUrl = "http://127.0.0.3" + oSession.PathAndQuery;
}
How can I get WordPress returned page to be rewritten before it gets sent to the browser, so it changes all 127.0.0.3
to my.domain.name
?
-- OR --
Is there a smarter way to go about all of this within WordPress?
I had a look at Change WordPress image URLs via filter because it is somewhat related, but could not figure it out.
Share Improve this question edited Oct 5, 2020 at 18:14 MeSo2 asked Oct 1, 2020 at 23:48 MeSo2MeSo2 1115 bronze badges 4 |1 Answer
Reset to default 0I added this to Fiddler's script in
%USER%\Documents\Fiddler2\Scripts\CustomRules.js under
OnBeforeResponse
and the response rewrite started working
static function OnBeforeResponse(oSession: Session) {
if (m_Hide304s && oSession.responseCode == 304) {
oSession["ui-hide"] = "true";
}
if (oSession.oResponse.headers.ExistsAndContains("Content-Type","text/html")){
oSession.utilDecodeResponse();
oSession.utilReplaceInResponse('127.0.0.3','my.domain.name');
oSession.utilReplaceInResponse('http:','https:');
}
}
and needed to set
// define('WP_HOME','http://127.0.0.3/blog');
// define('WP_SITEURL','http://127.0.0.3/blog');
define('FORCE_SSL_LOGIN',false);
define('FORCE_SSL_ADMIN',false);
in wp-config.php
In order to be able to log in I also had to remove the plugin simple-google-recaptcha
. There might be a way to set it up with reCAPTCHA not needing to be deactivated, but for now this is all I need.
127.0.0.3
– Tom J Nowell ♦ Commented Oct 7, 2020 at 16:24wp-config.php
, I have multiple separate multisite installs running locally here, and WP is unaware of the IP it's serving from, and I don't set the URL inwp-config.php
. I just set each site in a multisite to the desired domain and WP handles it fine. Settings the domain and site URLs inwp-config.php
is unnecessary. The only thing I can forsee is that Fiddler doesn't know how to route the requests to WordPress but that's a Fiddler problem not a WP problem. TLDR: Just use real URLs in your WP installs – Tom J Nowell ♦ Commented Oct 7, 2020 at 16:57