1

And also reproducible is this repo https://github.com/patarapolw/docker0000

I am opening http://localhost:8080 in Chrome Version 80.0.3987.163 (Official Build) (64-bit) / macOS 10.15.3 MacAir 15 inch

It gets redirected to https://localhost:8080 every time.

├── package.json
├── public
│   └── index.html
├── server.js
├── .dockerignore
└── Dockerfile
// server.js

const app = require('express')()
app.use(require('express').static(
  require('path').join(__dirname, 'public')
))
app.listen(8080, () => {
  console.log('Go to http://localhost:8080')
})
# Dockerfile

FROM node:12-alpine
RUN mkdir /app
WORKDIR /app
COPY package.json .
RUN npm i
COPY . .
CMD ["node", "server.js"]
// package.json

  "scripts": {
    "start": "docker run -p 8080:8080 express-sample",
    "build": "docker build -t express-sample ."
  },

Error message is

  • This site can’t provide a secure connection
  • localhost sent an invalid response.
  • ERR_SSL_PROTOCOL_ERROR

Must be some Chrome security...

1 Answer 1

1

Chrome has cached a redirect to https, you need to clear it:

  • Go to: chrome://net-internals/#hsts > Delete domain security policies
  • Enter your domain and click delete.
  • You may need to clear browser cache too: chrome://settings/clearBrowserData (Cached images and files)

As an alternative you can use another domain for developing that isn't cached, you can do that by editing /etc/hosts file and adding:

127.0.0.1 dev.foo

And then access to http://dev.foo:8080

7
  • Should I enter localhost:8080. No response on delete, and still cannot open localhost.
    – Polv
    Apr 17, 2020 at 9:56
  • 1
    just enter: localhost which is the domain. Apr 17, 2020 at 9:57
  • No change. Still redirects.
    – Polv
    Apr 17, 2020 at 9:58
  • Is that happening in other browsers? Want to make sure you don't have anything on the code. Apr 17, 2020 at 9:59
  • 1
    Also, you may need to clear browser cache. chrome://settings/clearBrowserData Apr 17, 2020 at 10:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.