Accessing a file on my domain relative to port - html

I am running a node server on port 3000. I have a css file stored just on http://mydomain.com/style.cssbut since every page right now is http://mydomain.com:3000/randompage.html How can I access the style.css file? I can get http://mydomain.com:3000/styles.css from the page I am working on, but that doesn't exist.
What is the best way to deal with this situation? I suppose it applies to any files I need to access.

I don't know a simple solution using a relative URL or some HTML magic in the page.
The usual solution is to install a module in Apache or a function in node.js which will redirect some requests to the other server so that for your HTML, everything seems to be coming from a single source.
This document should get your started when using Apache: Using mod_rewrite for Proxying

Related

how to show stencil JS build on html without localhost?

How to show stencil JS build on html without localhost ?
It is running on local server but I want only running the html file.
enter image description here
I am guessing you may have tried using the files directly from your local machine. This wont work because it will be blocked by CORS issue. Stencil has a lot of requests to load files to your browser when you use the webcomponet.
Possible Solution.
If all scripts can be bundled in to a single javascript file then it will be possible to use this without hosting.

Can not display drupal console and phpmyadmin on local host at same time

I am absolute beginner on Drupal, and nearly that on setting up localhost on my Mac along with MySql. My problem is I can't display Drupal and run phpmyadmin on separate tabs in my browser at the same time. I found that changing the 'AllowOverride' parm in my http.conf file will allow one or the other to work, but not both at the same time.
So in etc/apache2/httpd.conf <Directory "/Library/WebServer/Documents"> section:
If use 'AllowOverride None'
Can get to http://localhost/phpmyadmin/index.php
Cannot get to http://localhost/user/login (get 'The requested URL /user/login was not found on this server')
If use 'AllowOverride All'
Can not get to http://localhost/phpmyadmin/index.php (get 'You don't have permission to access /phpmyadmin/ on this server.')
Can get to http://localhost/user/login
Any ideas?
AllowOverride should be set to "All" since that way you are allowing .htaccess file to work properly (i.e. do redirections and make pretty urls work).
If phpMyAdmin is not working with that setup that means that Drupal's .htaccess rules are catching your requests to phpMyAdmin. That probably means that you installed Drupal directly inside web root and phpMyAdmin inside it's one directory (as a sub-site of Drupal). So even you are calling phpMyAdmin Drupal jumps in and takes control of that request.
One solution would be to install Drupal inside it's own directory, so you could access your project as i.e.
http://localhost/drupal
That way Drupal's .htaccess file will be inside drupal dir and not in web root dir.
Other solution would be to create virtual hosts, so depending on used domain web server would know which site to display (to serve request from which directory).

Is there a way to stop href from stripping out localhost from the path

Trying to make a webpage for local&personal use.
I want to have links that point to locations starting with the path \\localhost\C$\
but href strips out localhost and makes it file:///C$/
is there any way to get around this?
I've tried various things, the closest I've had to tricking it was using:
\localhost\C$\
which becomes file:///C:/localhost/C$/
but that still won't work...
you can't access a filesystem via a browser.
You need to call a server that has port 80 opened so you can access.
Maybe you want to access to http://localhost/
Therefore you must install and Run a Server (apache, etc) on your local system.

Send HTTP request through browser to a program that is listening on a port

So I am trying to build a C Program that handles HTTP requests through a web browser. The program is listening on a predefined port for incoming HTTP requests and responds appropriately. It is working totally fine when I place is it in the root directory but it doesnt work when I move it to directory on its own.
For instance, this works:
localhost:9000
but this doesnt:
localhost:9000/myprogram
Any clues on how I may fix this?
Hard to answer with so few details. But to get started I would check the following:
What does the web server log say?
Is the web server configured to allow execution of [CGI] in this directory?
Are you sure you haven't mixed up the web root with the directory root, thus placing your
program in the wrong place?
Are the directory and program access modes set correctly?

Hosting basic html site on iis

I have a basic web site (just html, js and css files) that I want to host on IIS on my local machine for testing purposes. The site runs fine when I run it directly as a file on my computer. I added a website on IIS, using the directory these files are located in, but when I try to launch it, I get an error page that says:
An error occurred loading a configuration file: Failed to start monitoring changes to '[my site path]' because access is denied.
It then says that the source file is a web.config. I know that ASP.NET sites use a web.config, but I don't even have one, and I just want to run a basic site using html, css, and javascript.
Any ideas on what the fix might be? I made sure I have an application pool for the site.
You likely put it into your user profile -- ie c:\users\skitterm\ -- which won't let the process running IIS read the folder. You are better off using IIS' built in directory structure in c:\inetpub and adding a folder for your site.
As you can tell this is a server misconfiguration. It would help to know the version of your IIS.
You can follow the steps on Microsoft's official knowledgebase to resolve the issue:
http://support.microsoft.com/kb/316721
http://support.microsoft.com/kb/317955 (for IIS v6.0, try Method 3)
I worked in IIS about a year ago and such errors are caused by misconfigured Security settings in IIS.
Sounds like you need to set up the proper access rights for the folder to the account specified by the application pool identity.
First make sure that your folder is not anywhere under your \users\, \program files\, or any other place that already has restricted access. Put it under a folder on the root (\inetpub is a good place).
Then, add the appropriate permissions (usually read only) for the folder to allow the user account specified by the app pool identity to access it. If the app pool identity is set to ApplicationPoolIdentity, adding the IIS_IUSRS local group should do it. Otherwise, use the account that is specified.
This should fix the problem.