projectdiscovery/simplehttpserver

Custom responses using tls

kurobeats opened this issue · 5 comments

Forgive me if I've missed something but I'm trying to set up a web server that will respond to POST requests but I'd like to encrypt the communication. Here's my rule file:

rules:
  - match: hey 
    response: |
              HTTP/1.0 200 OK
              Server: httpd/2.0
              x-frame-options: SAMEORIGIN
              x-xss-protection: 1; mode=block
              Date: Fri, 16 Apr 2021 14:30:32 GMT
              Content-Type: text/html
              Connection: close

              hello

But when run with the following (a few I've tried), I get errors thrown from curl:

Server: simplehttpserver -tcp -rules rules.yaml -listen localhost:443
Request: $ curl -X hey https://localhost/ curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:443

Server: simplehttpserver -rules rules.yaml -tcp -tls -domain localhost -listen localhost:443
Request: $ curl -X hey https://localhost/ curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:443

Am I missing something? It works fine so long as I'm not trying to encrypt.

cyal1 commented

I also encountered this situation

server : simplehttpserver --https --listen 0.0.0.0:443 -cert example.com.pem -key example.com.key -rules test.yaml -tcp -tls

HTTP ERROR 502

@kurobeats @cyal1 this should be now fixed in the dev version with following PR - #62

Thank you!

oops haha

cyal1 commented

@kurobeats @cyal1 this should be now fixed in the dev version with following PR - #62

It is not work use Custom Certificate Key