Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve dns hostname when ipv4/ipv6 hosts are reported by IServerAddressFeature #410 #442

Closed

Conversation

CarlosLanderas
Copy link
Contributor

@CarlosLanderas CarlosLanderas commented Mar 11, 2020

What this PR does / why we need it:

Allows resolve dns host when ipv4/ipv6 address formats are reported from IServerAddressFeature.
Formats like : [::], 0.0.0.0

Which issue(s) this PR fixes:

#410

@CarlosLanderas CarlosLanderas deleted the relative-uris-ui-support-listening-all-ips branch April 17, 2020 17:14
@ignatandrei
Copy link

Is this deployed on NUGET ?

@NicolasREY69330
Copy link

@CarlosLanderas
same question ?

I opened an issue directly refering to this : #553

@CarlosLanderas
Copy link
Contributor Author

After talking with a Microsoft member here:
#410

We decided is just easier to setup a dns name. Just configure it to use localhost.

@NicolasREY69330
Copy link

@CarlosLanderas

Thank you.
So we are supposed to change the ASPNETCORE_URLS environment variable to localhost ?

Something like this ?

docker-compose.yml

  myservice:
    image: ${DOCKER_REGISTRY-}myservice
    build:
      context: .
      dockerfile: src/myservice/Dockerfile

docker-compose.override.yml

 myservice:
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - ASPNETCORE_URLS=https://localhost:443;http://localhost:80 # localhost here ?
    ports:
      - "50708:80"
      - "44345:443"
    volumes:
      - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
      - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro    

@CarlosLanderas
Copy link
Contributor Author

CarlosLanderas commented Jun 10, 2020

@NicolasREY69330 yes, this should work. However, I don't use to specify the ASPNETCORE_URLS because if you expose 80 and 443 in the DockerFile you just need to specify ports like:

  • "80:80"
    or:
  • "8080:80"

@xico002
Copy link

xico002 commented Feb 9, 2021

I had this problem yesterday and tried to add UseUrls(http://localhost). I can see it works if I get the logs of the pod running but if I try to access my .net core application through my custom dns it gives me 502 bad gateway nginx. I´m using an ingress to deploy to kubernetes. Can someone explain to me what am I missing?

Regards

@MaxThom
Copy link

MaxThom commented Feb 22, 2021

Hi, I've been trying so many things to fix this issues. Ultimately, im trying to deploy on Azure WebApp for Linux Container, but for now i cant get it to work even on my local machine. Everything work except this. I tried settings env variable with urls: "http://localhost:80;https://localhost:443", but then even the index break. I tried to set absolute address on health endpoint, but without success. I changed Kestrel UseUrls to localhost, without success.

Any tips ?

@MithrilMan
Copy link

@MaxThom I've the same problem, actually my workaround (while developing and testing on docker locally) is to add an environment variable that sets the appsettings HealthChecks Uri

in my docker-compose.override.yml I have

services:
  my-service:
    environment:
      - HealthChecksUI__HealthChecks__0__Uri=http://localhost/healthz

My appsettings.json contains the healtcheck configuration that got overridden by docker-compose environment variable above

"HealthChecksUI": {
      "HealthChecks": [
         {
            "Name": "Core Service",
            "Uri": "/healthz"
         }
      ],
      "EvaluationTimeInSeconds": 10,
      "MinimumSecondsBetweenFailureNotifications": 60
   }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants