I installed succesfully the Vault in my Homestead VM. I want to manage it in browser. But when I try:
http://192.168.10.10:8200/ui/
http://mysite.app:8200/ui/
then I get:
Failed to connect to 192.168.10.10 port 8200: Connection refused
I tried to configure the port in Homestead.yaml:
ports:
- send: 8200
to: 8200
protocol: tcp
but it did not help.
In the VM it works:
$ curl localhost:8200/ui/
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="cache-control" content="no-store" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="pragma" content="no-cache" />
<title>Vault</title>
...
Related
I'm on a Mac and I'm attempting to run my k6 script against http://localhost:4200 (angular app) locally.
The angular app is running and I can access it via the browser and using curl.
My k6 script has the base URL set to http://localhost:4200. However, all requests are being made to http://127.0.0.1:4200 instead which is denied by MacOS.
How do I force k6 to NOT rewrite localhost to the loopback address?
EDIT
Adding various outputs of curl -vv.
localhost:4200
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 4200 (#0)
> GET / HTTP/1.1
> Host: localhost:4200
> User-Agent: curl/7.64.1
> Accept: */*
>
< HTTP/1.1 200 OK
< X-Powered-By: Express
< Access-Control-Allow-Origin: *
< Content-Type: text/html; charset=utf-8
< Accept-Ranges: bytes
< Content-Length: 942
< ETag: W/"3ae-UQojFJZul+b6hEhgbvnN6wFCVuA"
< Date: Thu, 20 Jan 2022 21:38:55 GMT
< Connection: keep-alive
< Keep-Alive: timeout=5
<
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>MyApp</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="assets/scripts/apm.js"></script>
<link rel="apple-touch-icon" sizes="180x180" href="/assets/images/apple-touch-icon.png">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="icon" type="image/png" sizes="32x32" href="/assets/images/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/assets/images/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="stylesheet" href="styles.css"></head>
<body>
<app-root></app-root>
<script src="runtime.js" type="module"></script><script src="polyfills.js" type="module"></script><script src="styles.js" defer></script><script src="vendor.js" type="module"></script><script src="main.js" type="module"></script></body>
</html>
* Connection #0 to host localhost left intact
* Closing connection 0
127.0.0.1:4200
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connection failed
* connect to 127.0.0.1 port 4200 failed: Connection refused
* Failed to connect to 127.0.0.1 port 4200: Connection refused
* Closing connection 0
curl: (7) Failed to connect to 127.0.0.1 port 4200: Connection refused
EDIT 2
Hosts file
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
# Added by Docker Desktop
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
There is no application listening on port 4200 for your IPv4 address 127.0.0.1. 127.0.0.1 is the IPv4 loopback address. When k6 makes a request to localhost, this hostname resolves to the IPv4 127.0.0.1.
However, your application seems to be listening on port 4200 for your IPv6 address ::1. ::1 is the IPv6 loopback address. curl resolves the hostname localhost to its IPv6 address.
How are you binding your application to the port? Usually, when binding to all interfaces of a host, you'd use the special IP address 0.0.0.0.
I see a potential solutions:
Make your application bind to IPv4 and IPv6, usually done by binding to address 0.0.0.0.
Change your k6 script to connect to IPv6 ::1 directly
Specify --dns "policy=preferIPv6" or add dns:{policy:"preferIPv6"} to your options (since 0.29.0)
Disable IPv6 in your OS. This is a drastic change and I wouldn't recommend it
Change your hosts file to resolve localhost to the IPv4 address
I would like to have an nginx server hosting web applications on the same domain, with different paths.
For example,
http://example.org/booksapp/signin.html should point to the first app,
and http://example.org/shoesapp/signin.html should point to the second app
within my host, I have two folders, one for each app:
/var/webfolder/booksapp and /var/webfolder/shoesapp
my nginx configuration is the following
server {
server_name example.org;
index index.html index.htm;
location /foodapp {
root /var/webfolder;
try_files $uri $uri/ =404;
}
location /shoesapp {
root /var/webfolder;
try_files $uri $uri/ =404;
}
listen [::]:80;
listen 80;
}
This configuration does not work. My browser just shows a blank page when trying to load either web application.
Meanwhile, the nginx log files shows a list of 404 for every resource that the apps are trying to load.
What am I doing wrong?
You have to change your html files to use the right paths.
Your "booksapp" lives at example.org/booksap/, the html pages must load any static resource using that same path.
This is the head section of an example html file. If you deploy this to any of your sites it will not work, nginx can't find "normalize.css" and "styles.css" unless you specify the right path. Right now nginx is acting as a router between the two apps, you can't ask for just a file, you must specify which app.
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type">
<title>sakura demo</title>
<link href="normalize.css" rel="stylesheet" type="text/css">
<link href="styles.css" rel="stylesheet" type="text/css" media="all">
</head>
It should be:
<link href="booksap/normalize.css" rel="stylesheet" type="text/css">
<link href="booksap/styles.css" rel="stylesheet" type="text/css" media="all">
I am using Apache2 to redirect from port 80 to port 8080 of tomcat. My url is like
<IP address of server:8080>/mymodule/
after redirecting my url looks like,
<IP address of server>/mymodule/
Now I want to remove "/mymodule", so what I have done is used
RewriteEngine on
RewriteRule ^/(.*)$ /mymodule/$1 [L,PT]
JkMount /* worker1
My problem is after doing this, my css,js, img files are not loading... Only my page is loaded, nothing else... How to rewrite expression to resolve this
If I am not using RewriteRule, my view page source look like this
<link rel="stylesheet" href="/mymodule/css/jquery.rating.css" />
<link rel="stylesheet" href="/mymodule/css/style.css" />
<script src="/mymodule/js/jquery-1.6.1.min.js"></script>
If I am using RewriteRule, my view page source looks like this,
<link rel="stylesheet" href="/mymodule/css/jquery.rating.css;jsessionid=684675C2B02778B6B8D8CDC0918F7320" />
<link rel="stylesheet" href="/mymodule/css/style.css;jsessionid=684675C2B02778B6B8D8CDC0918F7320" />
<script src="/mymodule/js/jquery-1.6.1.min.js;jsessionid=684675C2B02778B6B8D8CDC0918F7320"></script>
Help me to resolve this...
Change your RewriteRule like this:
RewriteRule !^/?mymodule/ /mymodule%{REQUEST_URI} [L,NC,PT]
I have a very weird situation, one of my CSS files is not able to load, I see HTTP 403 error in firebug.
My twig:
<head>
{% block head %}
<script type="text/javascript" src="/bundles/my/js/jquery.min.js"></script>
<script type="text/javascript" src="/bundles/my/js/jquery-ui.min.js</script>
<link rel="stylesheet" href="/bundles/my/css/Aristo/Aristo.css" />
<link rel="stylesheet" href="/bundles/my/css/style.css" />
{% endblock %}
</head>
My files structure:
I've run php app/console assets:install web --symlink successfully
app/console assetic:dump returns:
Dumping all dev assets.
Debug mode is on.
Note: js/jquery.min.js, js/jquery-ui.min.js and css/style.css loads fine, only Aristo/Aristo.css yells HTTP 403 error
Edit
GET http://my.local/bundles/my/css/Aristo/Aristo.css
Response message:
Response Header
HTTP/1.1 403 Forbidden
Date: Thu, 04 Jul 2013 18:28:36 GMT
Server: Apache/2.2.22 (Ubuntu)
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 260
Keep-Alive: timeout=5, max=97
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
Response HTML:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /bundles/my/css/Aristo/Aristo.css
on this server.</p>
<hr>
<address>Apache/2.2.22 (Ubuntu) Server at my.local Port 80</address>
</body></html>
Can anyone advise?
Thanks
You may use asset instead of direct path to your ressources :
<link href="{{ asset('css/Aristo/Aristo.css') }}" rel="stylesheet" type="text/css" />
see: http://symfony.com/doc/current/book/templating.html#linking-to-assets
Hope it's helpful
Best regard
We currently use an Nginx server for load balancing. We would like our office IP to be redirected to a specific server, where as all other traffic is load balanced normally.
Is this possible?
You can do a simple redirect with any web server (Apache, Tomcat, nginx, etc).
For example, on Java you can create a simple index.jsp with the following:
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Your Company</title>
<link rel="icon" type="image/png" href="http://www.yourloadbalance.com/favicon.png">
</head>
<body>
<%
response.sendRedirect("www.yourloadbalance.com");
%>
</body>
</html>
This piece of code will redirect each request to the given URL, in your case to the load balancer.
This is not a working config but I hope the main idea is clear
map $remote_addr $backend {
default app-servers;
192.168.1.1 dev-servers; # office IP
}
upstream app-servers { # this is normal upstreams group
server ...;
server ...;
}
upstream dev-servers { # this is upstream(s) for Office IP
server ...;
}
server {
listen 80;
server_name bar.foo.com;
location / {
proxy_pass http://$backend;
}
}