Answer the question
In order to leave comments, you need to log in
How to redirect from one domain to another?
I have a client application that accesses my server with an https request.
I want to write a second application that will change the address of my server to localhost and accept / respond to a request. Approximately such functionality is available in Open Server, when we create a domain folder, and it redirects all windows requests to example.com to open server
But there is one problem. I wrote a python server that runs on localhost:80, made a temporary redirect in the host file.
Example of my request:
example.com/api/sayhello
Without a redirect will return 200, with a redirect to host "localhost example.com" it will return 404, I think because it only refers to the example.com domain. I xs why he addresses only to the domain.
Python took only because you can quickly sketch a server, but I did not think that there would be a big problem in the redirect.
Why is 404 returned? Maybe there is a better way than redirecting via host ?
Maybe via c++ immediately change the address of the package to example.com on localhost ?
Answer the question
In order to leave comments, you need to log in
I'm sorry, one fable comes to mind, there's something about glasses ... It's not python's fault here, and not the programming language, but the lack of knowledge about:
- dns
- tcp / ip
- http
- operating system and in particular the hosts file
1) show your hosts
2) from which computer and where are you accessing?
3) does what you want work on localhost:80 ?
PS, if there is something to change, in assembler - definitely!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question