Requests are not being routed to my app, they take to c9 login

nodejs

#1

Hi,
I have an nodejs/express app that dynamically render a JS file: https://fbadserver-avifatal.c9users.io/getConfig via custom routing.
if you call it as an file directly in the url of the browser, it works fine.
but, if you call it from postman/curl you will get c9 login page:

why is that?

Thanks


#2

It’s because your application is private so you’re unable to view it without being logged in. You can make it public via the share button in the top right of your workspace.


#3

@timjrobinson Is there a way to authenticate the requests between workspaces so could have a private workspace as the API and then another private workspace which is calling the API with auth creds?

Or does the ‘API’ workspace have to be public?


#4

You probably want your own authentication on the API for when you deploy it to production. So I’d recommend making it public on Cloud9 and adding your own authentication to it so others can’t use it.


#5

I have a question in addition to this. I figured out that making a workspace public is necessary to be able to view the compiled application outside of the preview in cloud9.

I don’t like the cloud9 preview for 3 reasons. First, it only serves the compiled code through https and my Emberjs app communicates with a http API. This doesn’t go well together. Second, I like to use split pane view for coding, but this means I have to show the preview on one of the sides, while I prefer to have it full with. And last, I want to be able to use the Chrome DevTools for debugging my application and this doesn’t work well in the cloud9 preview.

Making the workspace public so I can see the compiled code in an isolated browser tab is the solution I guess but I do not want other c9 member to able to see my source code, since it’s a commercial application for a client I’m working on.

Any suggestions how to go about this?

Thanks!


#6

You don’t have to make the editor public to show others the compiled code. Simply share the “application” from the Share screen (the middle checkbox), then you can send the application link to other people. Keep the editor private so they can’t see your source code. See https://docs.c9.io/docs/share-a-workspace#section-share-your-application for more details.

To see your preview in a full screen and to be able to use Chrome dev tools simply click the popout button in the top right corner (Between the url bar and the cog). Then it will pop out into a new window.


#7

@timjrobinson thanks for the quick reply. I tried to use the pop out function but the new page shows a Page Not Found error.


#8

@timjrobinson Solved. To be able to use the pop out feature I first had to configure Preview as Public in the Share screen.