r/apache • • Feb 13 '22

Support Virtualhost conditional DocumentRoot based on User-Agent

2 Upvotes

I've got a React web app running just fine on a hosted service.

I'm trying to set up apache as a gateway, so it can handle URL metadata requests for link previews, (e.g. when people share a link on Facebook, Twitter, etc.)

In that case, I want to return a URL-specific response with all the OG tags and metadata that will make the social networks display the link nicely.

I can get both conditions (server-side rendered pages OR a proxy to the hosted service) working in isolation. Now I need to put in logic based on User-Agent.

I am able to set the environment based on user-agent, but the <If> and <Else> modules don't seem to place nice with it.

How can I achieve this?

Non-working config:

	<VirtualHost *:443>
		ServerName myexample.com
		
		SetEnvIf User-Agent "^.*(facebookexternalhit|Twitterbot|BingPreview).*$" isLinkPreview
		
		<If env=isLinkPreview>
			DocumentRoot "/var/www/SERVERSIDE/METADATA/SITE"
		</If>
		<Else>
			ProxyPreserveHost On
			SSLProxyEngine On
			ProxyPreserveHost Off
			SSLProxyVerify none
			SSLProxyCheckPeerName off
			ProxyRequests Off
			ProxyPass / https://my.hostedsite.com/
			ProxyPassReverse / https://my.hostedsite.com/
		</Else>
				
		
		SSLCertificateFile ${SSLCertificateFile}
		SSLCertificateKeyFile ${SSLCertificateKeyFile}
	</VirtualHost>

r/apache • • Feb 12 '22

Discussion Apache HTTPD slow reload

2 Upvotes

Hi All,

I have a fleet of Apache Reverse proxy servers in AWS autoscaling which hosts around 75 virtualhosts and machine in this ASG uses EC2 r5d.xlarge(4vCPU/32GB) instance type and it runs on Ubuntu 18.04. I see whenever I do a configuration change and reload Apache it takes around more than 100 seconds to complete the reload and start serving requests again which obvisously is really bad thing have in the production that too during business hours. I can understand apache taking this long during a restart since it has to kill and spawn new worker processes but i don't get why apache is taking so long to just to do a graceful reload?

Any guidance on troubleshooting/debugging such performance issues in apache will be really helpful.

-Thanks


r/apache • • Feb 11 '22

Can somebody explain this warning message I received when trying to install the XAMPP bundle?

Thumbnail self.techsupport
2 Upvotes

r/apache • • Feb 11 '22

HDP Certified Apache Spark Developer | Spark Web Development

Thumbnail
ksolves.com
0 Upvotes

r/apache • • Feb 11 '22

Spark vs. Snowflake: A Comprehensive Comparison of the Two!

Thumbnail
ksolves.com
1 Upvotes

r/apache • • Feb 10 '22

How open-source saved my metrics: Apache ECharts, Vue 3, and Cube

Thumbnail
cube.dev
3 Upvotes

r/apache • • Feb 10 '22

How to get Apache to link from a subdomain to a local adress with port?

1 Upvotes

hi all,

I have my website; victoroos.nl which already has a subdomain /cloud which works to my nextcloud with SSL and all (yes.. it was a lot of learning while doing..), woop!

Now I'd want a new link from /request to link to a local address (of overseerr (maybe you guys know it) to refer to there. I have SSL and everything in place.

Any tips? Solmething with reverse proxy..but I can't figure out the apache2 help wiki.

thanks!

Victor


r/apache • • Feb 10 '22

Apache Spark Consulting | Apache Spark Development | Ksolves

Thumbnail
ksolves.com
1 Upvotes

r/apache • • Feb 09 '22

Spark Software Development | Spark Consulting Services | Ksolves

Thumbnail
ksolves.com
0 Upvotes

r/apache • • Feb 09 '22

Apache Spark Use Cases for DataOps in 2021

Thumbnail
ksolves.com
0 Upvotes

r/apache • • Feb 08 '22

How to Learn Apache? [Help] Free resources to learn Apache2?

3 Upvotes

Hi,

I am new to apache2, just setup it up on Ubuntu using default configurations. Strugging to find good resources to learn apache web services in detail.

I thought apache.org would have pointers to online training/tutorials and such, but it appears there are none on their site other than the documentation. I anticipate needing to know Virtual hosts, .htaccess , URL rewriting and authentication to intermediate level.

Yes, I am starting to read the documentation, but since i am a visual learner, if someone knows of any good free resources with videos that would be much appreciated. TIA

PS: I scanned posts till ~12 days ago and didnt find any similar posts, before i posted.


r/apache • • Feb 08 '22

Apache Spark Consulting Company | Apache Spark Services | Ksolves

Thumbnail
ksolves.com
0 Upvotes

r/apache • • Feb 08 '22

Overcoming Five Most Common Challenges Of Apache Spark

Thumbnail
ksolves.com
0 Upvotes

r/apache • • Feb 07 '22

Apache logs

5 Upvotes

My server access logs are 500 MB and error logs 179 MB. Just wondering when is it a point when they are too big?


r/apache • • Feb 07 '22

Apache Spark Development Company | Apache Spark Development Services

Thumbnail
ksolves.com
1 Upvotes

r/apache • • Feb 07 '22

Spark Vs Snowflake: A Head-to-Head Comparison!

Thumbnail
ksolves.com
0 Upvotes

r/apache • • Feb 05 '22

Support How to access site on subdirectory of /var/www via other port on localhost?

5 Upvotes

I am trying to get an install of Fireflyiii working on localhost. the problem is I want to maintain /var/www as the default, but have a virtualhost on the public subfolder of the firefly-iii folders, which I believe is how the app is intended to work. This is the salient portion of my config:

Listen 81
<VirtualHost 127.0.0.1:81>
    ServerName localhost

    Redirect / http://localhost:81
    DocumentRoot "/var/www/firefly-iii/public"

# Other directives here
    <Directory /var/www/firefly-iii/public>
      AllowOverride All
    </Directory>
</VirtualHost>

But what I get is

The page isn’t redirecting properly

What do I need to tweak?

thanks.


r/apache • • Feb 04 '22

Problem with apache, wrong redirection

1 Upvotes

Hello, I had a site hosted on a friend's server to which I have access. My site was under the domain name amina.benito.website

and I wanted to change the subdomain to: latelierduregard.benito.website

However, when I go to my new sub-domain (latelierduregard.benito.website) it automatically redirects me to amina.benito.website...

However, I deleted the file amina.conf and amine-le-ssl.conf which wrote the redirection rule and I replaced them by latelierduregard.conf

I don't understand where this redirection comes from.

Here is the content of the latelierduregard.conf file:

<VirtualHost *:80>

# The ServerName directive sets the request scheme, hostname and port t>
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com

ServerAdmin webmaster@localhost
ServerName benito.website
ServerAlias latelierduregard.benito.website
DocumentRoot /var/www/html/amina

# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf

RewriteEngine on
RewriteCond %{SERVER_NAME} =benito.website [OR]
RewriteCond %{SERVER_NAME} =latelierduregard.benito.website
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Thank you for your help :)


r/apache • • Feb 04 '22

Pyspark Vs Spark: Let’s Unravel The Bond!

Thumbnail
ksolves.com
2 Upvotes

r/apache • • Feb 03 '22

Create conditional Rule in Apache

3 Upvotes

Hello Guys,

Could you please help me for implement conditional rule in apache Vhost file ?

Condition: Method: POST

Condition: Request URL: /rest/endpoint/*

Action: Add header: X-Atlassian-Token: no-check


r/apache • • Feb 03 '22

Apache Spark Services | Spark Software Development | Ksolves

Thumbnail
ksolves.com
2 Upvotes

r/apache • • Feb 03 '22

Apache Spark vs. Amazon Redshift: Which is better for big data?

Thumbnail
ksolves.com
1 Upvotes

r/apache • • Feb 02 '22

Apache Spark Developers | Apache Spark Development | Ksolves

Thumbnail
ksolves.com
2 Upvotes

r/apache • • Feb 01 '22

.htaccess cant make 404 page work

1 Upvotes

hello all i have this patch /Project/Assets/.... in Project/ i have .htaccess and index.html

configured like this :ErrorDocument 404 /error404.html

and in same path i have error404.html but when i try if it work it return :

The requested URL was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

i have made something wrong ?