I need to add a variable in sails configuration that refer to the application name and use this name as a prefix in all generated links as css, js,images files
sailsjs generate these link automatically and add include commands to the page.
So, how can i modify this generation of links to include the name as prefix
Use an HTML base tag. If your application name is "sails-app-1" then:
<!doctype html>
<html>
<head>
<base href="https://example.com/sails-app-1/">
</head>
<body>
<img src="example-image.gif" width="100" height="100" alt="https://example.com/sails-app-1/example-image.gif">
https://example.com/sails-app-1/page-1.html
https://example.com/page-2.html
https://example.com/page-3.html
</body>
</html>
Relative paths for script, link, image, and anchor tags will be appended to the base tag's href attribute.
Absolute paths and URLs will not be affected.
I dont think your most optimal solution is rewriting links or modifying project structures, you are already inside a project!
Here is what I suggest you do: Use Apache as a reverse proxy to your sails instances by adding this to you site configuration:
ProxyPreserveHost on
ProxyRequests Off
ProxyPass /sails-project-1/ http://127.0.0.1:1337/
ProxyPassReverse /sails-project-1/ http://127.0.0.1:1337/
ProxyPass /sails-project-2/ http://127.0.0.1:1338/
ProxyPassReverse /sails-project-1/ http://127.0.0.1:1338/
ProxyPass /sails-project-3/ http://127.0.0.1:1339/
ProxyPassReverse /sails-project-1/ http://127.0.0.1:1339/
also you may need to add process.env.npm_project_name to prefix in config/blueprints.js
Note: process.env.npm_project_name is only available if you run your app using npm start rather than sails lift
Related
After using the Python http.server module I'm now trying to convert everything to Bottle and can't even get started. My problem is locating static files - everything I've tried results in a "404" error. So I've tried to reduce everything to the simplest possible example. My top level directory is in "/home/dave/test" and under that is a single file (test.py), and a subdirectory ("/home/dave/test/static") containing the single file "index.html". The html file is pretty basic:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bottle Test</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h1>Hello, World</h1>
</body>
</html>
If I double click on the file itself, it opens a new browser page and displays the "Hello, World" message. The test.py file is:
#!/usr/bin/env python3
from bottle import route, run, static_file
#route('/static/<filename>')
def server_static(filename):
return static_file(filename, root='/home/dave/test/static')
run(host='localhost', port=8080, debug=True)
If I open a browser window and enter "localhost:8080/index.html" I get back the "Error: 404 Not Found" message and the terminal window where I'm running the script looks like:
$ ./test.py
Bottle v0.12.16 server starting up (using WSGIRefServer())...
Listening on http://localhost:8080/
Hit Ctrl-C to quit.
127.0.0.1 - - [06/Apr/2019 15:31:25] "GET /index.html HTTP/1.1" 404 740
I've tried various permutations of the URL and root parameter but nothing I've tried works. Clearly I'm missing something very basic here. Can somebody tell me what is wrong in in the above files (or URL)?
Thanks,
Dave
I was able to contact the author of Bottle and he responded:
a route matches against the path-part of an HTTP request URL. In your
example, '/static/' would match requests to
http://localhost:8080/static/index.html and serve 'index.html' file
from the '/home/dave/test/static' directory.
"http://localhost:8080/index.html" does not match the route you
specified, thus the 404 error.
I tried this and it did indeed fix the problem.
I have created my virtual host(magento226.com) using this link for magento 2.
sudo nano /etc/apache2/sites-available/magento226.com.conf
<VirtualHost *:80>
ServerName magento226.com
ServerAlias www.magento226.com
ServerAdmin mohit.rane69#gmail.com
DocumentRoot /var/www/html/magento_226
<Directory /var/www/html/magento_226>
Options Indexes FollowSymlinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
which is working fine.
I want to verify Virtual host(magento226.com) on google merchant center/google search console but i keep getting this error
Verification failed - We were unable to connect to your server.
Claiming failed - You must verify your URL before you can claim it.
1. Html File Method :-
Changes
I've downloaded this HTML file:google4ef0b3cccc5bb7d2.html and placed in my magento 2 root directory which is /var/www/html/magento_226
Error
2. Html Tag Method :-
Changes
Copy the meta tag below, and paste it into your site's home page. It should go in the <head> section, before the first <body> section.
<meta name="google-site-verification" content="JZlP-i7XEbOg4JCeCVZTp9pEHIJIOPNNJBwmZsEbWI0" />
Error
3. Google Tag Manager :-
Changes
I've pasted the given code in the <head> and the <noscript> in starting of the <body>
Error
4. Domain name provider :- I'm using Virtual host so this option is useless for me.
I've tried almost all the methods but doesn't seems to work.
Please let me know if anyone have a solution.
I have a zul file running on a localserver (localhost:8080) that uses a JavaScript file stored in a separate local server (localhost:3000):
<script type="text/javascript" src="http://localhost:3000/javascript/bower_components/angular/angular.js"></script>
If I want to place the url of the separate local server in a properties file, what is the best approach for doing so? I have tried to add a placeholder:
<script type="text/javascript" src="${graph.widget.url}/javascript/bower_components/angular/angular.js"></script>
then add in the properties file:
graph.widget.url=http://localhost:3000
and then add in the zk.xml file:
<system-config>
<label-location>file:///home/asd/resources/dev-common.properties</label-location>
</system-config>
but somehow it doesn't work: it looks for http://localhost:8080/javascript/bower_components/angular/angular.js (the local server where the application runs) instead of http://localhost:3000/javascript/bower_components/angular/angular.js. What am I doing wrong?
You have to prefix the key with the labels segment.
<script
type="text/javascript"
src="${labels.graph.widget.url}/javascript/bower_components/angular/angular.js">
</script>
Source: https://www.zkoss.org/wiki/ZUML_Reference/EL_Expressions/Implicit_Objects/labels
I am trying to run my first Perl Catalyst application using Apache and fastcgi.
Starting the server is fine, I can see the application's main page. All images/javascripts are loaded correctly (so, I assume the static content is served correctly).
For reasons I don't understand the dynamic content gives me a 404: e.g. when trying to go to www.webapp.org/search, I get "The requested URL /search was not found on this server."
Ok, here is how I set the aliases for the static content and
Alias /static /webapp/root/static/
Alias / /webapp/script/webapp_fastcgi.pl
I set the documentroot with
DocumentRoot /webapp/
Furthermore, I have a
<Location />
Options +ExecCGI
Order allow,deny
Allow from all
AddHandler fcgid-script .pl
</Location>
and a directive
<Files /webapp/script/webapp_fastcgi.pl>
PassEnv PERL5LIB
SetHandler fastcgi-script
</Files>
There is nothing else in the config file.
How can I add a directive to allow serving dynamic content (www.webapp.com/search)?
Thanks a lot in advance!
I see a space in AddHandler section. Please check your config file for typo's.
AddHandler fcgid-script .pl
Also please read this if you not did it already:
http://wiki.catalystframework.org/wiki/deployment/apache_fastcgi
For development work you could use catalyst without apache hassle: http://search.cpan.org/~mramberg/Catalyst-Runtime-5.80012/lib/Catalyst/Engine/FastCGI.pm#Standalone_FastCGI_Server
Assuming apxs installed mod_fastcgi.so into /usr/local/apache/libexec, add the following to an Apache .conf file:
LoadModule fastcgi_module libexec/mod_fastcgi.so
<IfModule mod_fastcgi.c>
FastCgiExternalServer /tmp/myapp.fcgi -host myhost:8081
Alias /myapp/ /tmp/myapp.fcgi/
</IfModule>
I have a GWT application /application.html
for easy access (and SEO) I would like make url rewriting like /station/fr/foo mapping
I'm trying with a servlet filter declared like this
url-pattern : /station/*
and in this filter, I split parts of the url to build parameters for the target url:
and I do :
request.getRequestDispatcher( targetUrl ).forward( request, response);
But it seems to try accessing /station/Application.html and then 404
[ =========== edited from here =========== ]
Well, know, since this question, I understood a few things: the html page is reached, but tries to load his resources (css, js, img) in /station/
This behaviour is done by the browser (!)
If I had <base href="http://servername/"> it works, but I can't get dev mode working anymore...
Is there's a way to transparently modify on the fly the response to change paths in html source ?
You are looking for fixing the app path in both hosted jetty mode and tomcat/deployment mode to be same - Try https://groups.google.com/d/topic/google-web-toolkit/a8OsRmMSaMg/discussion
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
"http://jetty.mortbay.org/configure.dtd">
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<Set name="contextPath">/yourapp</Set>
</Configure>