Binding web address to localhost - asp.net

I'm trying to implement a card payment provider to my web shop, but it only accepts a real URLs as success, error and cancel callbacks. For example, the success callback should be https://www.mywebshop.com/Checkout/PaymentSuccessful
As I want to test the mentioned functionality locally, I need to set the payment success callback to https://localhost:44328/Checkout/PaymentSuccessful, but the card payment provider don't accept it (it redirects to error callback instantly).
So, I guess I should add following rows to my hosts file:
127.0.0.1 mywebshop.com
127.0.0.1 www.mywebshop.com
Unfortunately, that didn't work - the local app is running but when I request mywebshop.com, I got messages below (I also tried with https/http/www)
This site can’t be reached
mywebshop.com refused to connect.
When I add a port, like https://mywebshop.com:44328/, I got error:
Bad Request - Invalid Hostname
HTTP Error 400. The request hostname is invalid.
If I add following binding to my applicationhost.config, nothing changes.
<binding protocol="https" bindingInformation="*:44328:mywebshop.com" />
<binding protocol="https" bindingInformation="*:44328:www.mywebshop.com" />
I also tried adding URL reservations with netsh, but it was unsuccessful.

You can use Ngrok for your testing. Ngrok exposes local servers behind NATs and firewalls to the public internet over secure tunnels. Please check how it works page here and its documentation here. Their free plan is sufficient for testing.
So download ngrok and run the ngrok.exe. Run below command which will give you public url - something like http://4a950b92.ngrok.io/ which will point to your local site. Hopefully that will solve your problem.
ngrok http -host-header=localhost 8080

Related

ngrok having issues starting - X509 certificate signed by unknown authority

I'm using ngrok 3.1.1 and trying to open up port 8000 so I can do some local testing. However, I keep running into some issues.
First off, I've downloaded and installed ngrok from the official site, and then added by authorisation token using:
ngrok config add-authtoken blahblahblahcrazywordsmoustache
So far so good. Then, trying to open ngrok using:
ngrok http 8000
Yields the following errors:
reconnecting (x509: certificate signed by unknown authority)
Followed by:
reconnecting (jsonHTTP.Lookup: No such host: tunnel.ngrok.com)
And...
reconnecting (resolved tunnel.ngrok.com has no records)
The ngrok.yml looks like this:
root_cas: trusted
version: "2"
authtoken: ohlooksomelettersarenttheynice
Any idea what I can do? This is on a corporate network, with various firewalls etc. I'm told that ngrok will create a url that I can use in my code tests, but we can't whitelist that url until we know what it is, and we don't know what it is until ngrok starts and generates it.
Okay, not quite a solution but more of a work-around.
Disconnected my computer from the corporate network, used a wifi dongle and hotspotted to my phone.
Got an error saying that my account wasn't authorised to use custom CAs. Wracked my head for a bit until I remembered that I had seen cas before, in the yml file. Removed the
root_cas: trusted
from the yml, and all working fine and dandy.

Deno Server doesn't go through the Internet

I built a simple Webserver with just the serve function from the std http module. It just redirects a request to a new URL:
import { serve } from "https://deno.land/std#0.120.0/http/server.ts";
serve(req => Response.redirect("https://google.com"))
It works, when I access the server through a browser on my laptop, where the server is running, but when I try to access it on another machine in the same network using the ip-address of my laptop, there simply is no response at all. Is this one of the security features Deno has and if so, how can you deactivate it?
Update:
So I tried looking up the requests I make on my local machine in Wireshark, but when I run the server and send a request, it doesn't show up there. I disabled my Wifi Connection to see if that changes anything and to my surprise, I still got an answer from the server when I sent a request through the browser. I came to the conclusion that the Deno server somehow doesn't serve over the local network which really confuses me. Is there a way to change that behaviour?
This is not related to Deno, but rather the firewall features of your device/router/network or an error in the method that you are using to connect from the other device (typo, network configuration, etc.).
Without additional configuration (by default), serve binds to 0.0.0.0:8000, so — as an example — if your laptop is assigned the local address 192.168.0.100 by your router, you could reach the server at the address http://192.168.0.100:8000.
You might want to do research on SE/NetworkEngineering and elsewhere to determine the cause of the blocked connection.

I am not not able run an website in localhost

This site can’t provide a secure connection localhost sent an invalid response.
Try running Windows Network Diagnostics.
ERR_SSL_PROTOCOL_ERROR
When running a service or site locally you can avoid this problem by doing the following:
In project properties enable SSL:
Make sure to put https link as a start URL or just make direct request to https version:

WSO2 /token resource not found

I'm trying to get a token to use in a call to a service published through WSO2 API Gateway and for that I'm calling the /token resource on https://:8243/token with a POST method and "grant_type=client credentials" and the correct Authorization header but the server returns 404 resource /token not available
If I use the Curl call generated using the "store" application I get the same error.
If I use the resource through the carbon application everything works though, I make the call to https://:9443/oauth2/token and I get the token back
Could anybody help me getting the application on the 8243 port to work?
Thanks
apimanger serves https api calls in port 8243 and http api call in port 8280 and it is defined under transportReceiver in the axis2.xml /repository/conf/axis2/axis2.xml).
Even though it is listening 8243 , if that port is not opened to outside from your server, then you will not be able to access via port 8243.So
Check whether port 8243 is opened in your server where apimanger gateway runs .You can use telnet command and check whether you are able to connect to it.
Check if in < APIM > /repository/deployment/server/synapse-configs/default/api you find the _ TokenAPI _ .xml
I had the same issue and found the file renamed with .back. Removing the .back extension and restarting the server worked.

Invalid URI for Localhost

We have a website/webservice running on one of our servers. We hit that webservice once a day with a scheduled .bat scipt.
Just recently the scheduled task started to fail. The log shows "Invalid URI: The hostname could not be parsed."
When we're logged into the server we can reach the website through http://localhost/website, but get an Invalid URI error when we hit the webservice http://localhost/website/ws.asmx.
Any ideas?
Edit:
We'be tried using the servername, the ipaddress, and port numbers (and combinations therein). Any other ideas?
For the private IP Address your using Wikipedia Reference http://en.wikipedia.org/wiki/IP_address for what are the limits and proper uses.
If you have access to the source code for the web service look for fixed IP Address being used along with having correct Server Bindings for using the service.
Try using the IP Address of the machine instead of localhost.
Basically, I'm taking a wild stab that someone ran a lockdown or a service patch was installed that somehow is filtering request resposes to localhost (127.0.0.1).
Try using the machine name instead of localhost

Resources