Test HTTP redirect to HTTPS on the live production server - http

I have a production server with a live website configured to use SSL. It has also been configured to redirect any HTTP URLs to the HTTPS.
I would like to be able to view the website from the server and test the redirect taking place. Instead I get an error message about permissions.
If I type the the HTTP url from a different machine I am able to view the website, i.e. the HTTP url has automatically been converted into an HTTPS url.
The question is how can I test the HTTP redirect from the production server?

You either make the webserver also listen to localhost (127.0.0.1), or you make the test bind to the external IP of the host.

Related

Which app is in charge of URL redirection in a WordPress site?

I just wonder which app is in charge of URL redirection in a WordPress site.
In my site, there is a real folder at /downloads/files/. Now I find there are some 404 errors in accessing https://www.datanumen.com/downloads/files/sitemap.xml, so I want to redirect the URL to https://www.datanumen.com/sitemap.xml
I try several methods:
Add the following redirect in .htaccess in the root folder:
Redirect 301 /downloads/files/sitemap.xml https://www.datanumen.com/sitemap.xml
But that does not work.
Install Redirection plugin and setup a redirection from
/downloads/files/sitemap.xml
to
/sitemap.xml
But still not work.
So I am curious that in a WordPress site, when I input a URL, will the URL be processed by WordPress system first(in which method 2 will take effect), or processed by Apache first(in which method 1 will take effect)? Why both methods do not work?
Apache/.htaccess catches the request first. It is Apache that sends the request to WordPress/PHP.
However, looking at the HTTP response in the browser...
cf-cache-status: HIT
server: cloudflare
The 404 response you are seeing is coming from your CDN's cache. The request isn't even reaching your application server in order to process the redirect.
/downloads/files/sitemap.xml
HOWEVER, are these legitimate requests for your sitemap XML file? This seems unlikely. So, I'd question whether these requests need to be redirected in the first place?
Note that /sitemap.xml is itself redirected to /wp-sitemap.xml so /sitemap.xml would not seem to be the correct target anyway.
client sends ip packet to a host and specifies that the data in the ip packet is for a particular port number, apache listens on specific port numbers as do most network applications, if the ip packet is for one of the port numbers apache is listening on the operating system will route the ip packet to apache, apache then can see a request for file i.e. html,pdf,jpeg,etc. apache then retrieves that file,image,etc from the server storage medium i.e. ssd or hdd, if the file contains php code then apache will parse the php itself before serving the file to the client.
hardware for server computer i.e. cpu,gpu,ram,memory
operating system i.e. linux
server app than run on the operating system i.e. apache
php files i.e. wordpress
So basically Apache acts first i.e. the server configuration files then when Apache parses the wordpress php files, the php script is executed secondly.

Forced to use wss:// when behind proxy from https to http

I have setup a nginx proxy to pass https url to internal http neo4j web. I can reach the neo4j login page without any issue, but I am forced to use the neo4j+s/bolt+s interface.
Just wondering how I can configure nginx to remove any ssl related info via proxypass module, in order to login in neo4j with ws, no wss?
Thanks,
Chance
I managed to get rid of wss by adding another nginx proxy to set the https url as upstream server in location.proxy_pass. It won't show wss/neo4j+s/bolt+s any more once you visit the web by the http url. Hopefully it will help for anyone has the similar issue as me.

NGINX redirect to URL if the requested server returns status code

I have a basic nginx server set up and now I want to make specific different servers.
I have one central server which hosts a website, and two java applications which both serve APIs.
Unfortunately, it is hard for me to redirect the users to a specific URL if they do something wrong in the java application.
I want it so that when the Status Code that the proxied Server (the server I got proxied to by nginx) returned is a specific one, it redirects you to a specific URL.
Fixed it using a NGINX built in feature: http://nginx.org/en/docs/http/ngx_http_core_module.html#error_page

Https communication on localhost in IIS using self-signed certificate

I have 2 sites running on the same machine, a client and an API.
Let's say the computer's IP is 10.10.10.10.
The API has a default page when you browse to it, the rest of the API is under 10.10.10.10/api.
The API has HTTP binding to port 80, and HTTPS binding to port 443.
The client has HTTP binding to port 8080, and HTTPS binding to port 64300.
Both HTTPS bindings use a self signed certificate I created via IIS manager.
Both sites have a HTTP to HTTPS redirect using "URL Rewrite".
When I try to browse either one of the apps, it works fine (gives the warning in the browser that you can skip).
When I do some action in the client which involves a HTTP request to the api using one of the following calls I get an error:
http://localhost/api/someMethod
http://localhost:80/api/someMethod
https://localhost/api/someMethod
https://localhost:443/api/someMethod
https://10.10.10.10/api/someMethod
The exception includes this error:
"The remote certificate is invalid according to the validation procedure"
I tried using the method described in this link (add the self-signed certificate to the Trusted Root Certificate Authorities folder) but it won't work.
Help please :D
found the answer.. posting if anyone else will get stuck on it.
It's pretty weird but the only thing that worked was to make the localhost http(s) request using the HOST NAME.
example:
https://the_name_of_the_computer:443/api/someMethod

IIS bindings - example.com and www.example.com

I simply want both example.com and www.example.com to go to the same website. Currently we have just added a binding to each. This creates a problem for WCF which then breaks because it says it can only accept one http address.
Is there a better way to configure a site to accept addresses with or without 'www'?
this has to be changed in the dns using a host or a record.
You shouldn't be hosting a site on the root domain. Better approach here is to redirect traffic to the root (.example.com) to the correct site (www.example.com) using an HTTP 302.
The WCF service should only receive traffic on its single binding. Use DNS, HTTP redirection, or some Traffic management application/appliance to get traffic from multiple points to the correct one.

Resources