Comments (4)
Hi @klvnraju,
I double checked and it seems that was really an issue with the CORS settings on my ASP.NET Core service.
In my case I tried to use wildcard subdomains (e.g. "https://*.devtunnels.ms") and there are two things that I was missing:
- You need to explicitly call
SetIsOriginAllowedToAllowWildcardSubdomains()
to allow for the use of wildcard subdomains - At the time of writing wildcard subdomains cannot contain a wildcard port. So a wildcard like this:
https://*.devtunnels.ms:*
(to allow for a random port) will resume in an error. In my case I just provided the port that I wanted to the wildcard e.g.https://*.devtunnels.ms:4200
and than it started working.
This issue can be closed from my end as it is not an issue related to Dev Tunnels. It just something to keep in mind while one is setting up CORS configuration 😄
from dev-tunnels.
Were you able to solve this somehow? I'm running into the same issue.
from dev-tunnels.
Did you add access-control-allow-origin header for your server?
I am trying to repro this issue with this sample code and things seems to be working as expected.
Below is the nodejs server code which adds CORS header. (Update the origin to the client tunnel address and make sure this is anonymous tunnel)
const express = require('express');
const cors = require('cors');
const app = express();
const ingredients = [
{
"id": "1",
"item": "Bacon"
}
];
// Update this with client tunnel url. Change it to '*' if you want to allow all
app.use(cors({
origin: 'https://qjrvmwhh-5070.usw2.devtunnels.ms'
}));
app.get('/ingredients', (req, res) =>{
res.send(ingredients);
});
app.listen(6069);
And below is a simple client index.html to call this api. (Update the server tunnel url)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Home</title>
<script type="text/javascript">
fetch("https://qp1bckqj-6069.usw2.devtunnels.ms/ingredients").then(req => req.text()).then(console.log)
</script>
</head>
<body>
<div class="container">
<h1>Home</h1>
</div>
</body>
</html>
And note the access-control-allow-origin header that server responds with.
from dev-tunnels.
Glad to hear that. Closing the issue.
from dev-tunnels.
Related Issues (20)
- Add support for GCCH tenants HOT 2
- App occasionally goes to the wrong port HOT 1
- Why some ports can be accessed with :PORT and others cannot HOT 2
- Bandwidth
- devtunnel user login hangs
- SSH user name is required for a port with SSH protocol. HOT 1
- Google emulator rediect with url login failing 9/10 times when going trough tunnel HOT 4
- Skip AntiPhishing page on user click/interaction HOT 5
- Can a request returning a file cause issues? HOT 2
- Force authentication HOT 2
- Closed
- GRPC over dev tunnels HOT 2
- Object reference not set to an instance of an object. HOT 2
- Wrong IP address in x-forwarded-for request header HOT 3
- Non-Interactive Login HOT 2
- Not able to load tunnel url as iframe src HOT 2
- Constantly getting 404 totally randomly for angular chunks HOT 4
- Homebrew SHA256 mismatch HOT 1
- Outage for non US traffic HOT 3
- Dev Tunnels CLI on armv7l
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dev-tunnels.