[Seaside] Configuring Zinc & Seaside to listen 127.0.0.1 only

Sven Van Caekenberghe sven at stfx.eu
Mon Dec 23 22:25:37 UTC 2013


Esteban,

On 23 Dec 2013, at 20:20, Esteban A. Maringolo <emaringolo at gmail.com> wrote:

> Hi,
> 
> I tried to start the server as per your instructions, but something
> didn't work as expected. I'm getting a HTTP 500 response when trying
> to access an REST API (WaRestfulHandler subclass).
> 
> | server wsServer adaptor |
> server := ZnServer on: 8080.
> server bindingAddress: nil.
> adaptor := ZnZincServerAdaptor new.
> adaptor server: server; configureDelegate; configureServerForBinaryReading.
> adaptor start.
> wsServer := ZnServer on: 8081.
> wsServer bindingAddress: nil.
> wsServer delegate: (ZnWebSocketDelegate map: 'ws' to: GptWsHandler new).

I tried again, the instructions:

| server adaptor |
server := ZnServer on: 8080.
server bindingAddress: NetNameResolver loopBackAddress.
adaptor := ZnZincServerAdaptor new.
adaptor server: server; configureDelegate; configureServerForBinaryReading.
adaptor start.
server.

or

| server adaptor |
server := ZnServer on: 8080.
server bindingAddress: nil.
adaptor := ZnZincServerAdaptor new.
adaptor server: server; configureDelegate; configureServerForBinaryReading.
adaptor start.
server.

just work.

Please inspect 

ZnServer allSubInstances.

it is very easy to get things mixed up and have multiple servers running, with the wrong one, the one you don’t expect, being active.

Also, in your code above, you didn’t start the second server.

>> POST /gpt-api/v1/events HTTP/1.1
>> User-Agent: curl/7.26.0
>> Host: servervm:8080
>> Accept: */*
>> Content-Type: application/json
>> Content-Length: 162
>> 
> * upload completely sent off: 162 out of 162 b
> < HTTP/1.1 500 Internal Server Error
> < Content-Type: text/plain
> < Content-Length: 512
> < Date: Mon, 23 Dec 2013 19:02:54 GMT
> < Server: Zinc HTTP Components 1.0
> <
> Internal Error: receiver of "delegate" is nil

You could put the server in #debugMode: and explore things in a debugger from there on.

> If I start the server like this:
> ZnZincServerAdaptor  stop.
> ZnServer stopDefault.
> ZnZincServerAdaptor  startOn: 8080.
> ZnServer startDefaultOn: 8081.
> ZnServer default
> delegate: (ZnWebSocketDelegate map: 'store-status' to:
> GptStoreStatusHandler new).
> 
> Everything works perfectly.
> 
> I'm bounding the server to nil, because bounding to localhost worked
> but I need to find a workaround to reach the Seaside /config app
> externally from the nginx.
> 
> Clues?

Either you bind to the local interface, limiting access for security, or not, there is no way around it.

I could imagine having a locally bound Seaside instance being proxied selectively, exposing what you want, the way you want it, to the outside world. Does that make sense ? You have to be careful with the /admin interface though.

HTH,

Sven

> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



More information about the seaside mailing list